[pypy-issue] [issue1177] The empty string is a new object every time

Amaury Forgeot d Arc tracker at bugs.pypy.org
Thu Jun 14 10:47:34 CEST 2012


Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:

This is not always true, even with CPython:
>>> x = u'\xe9'.encode('ascii', 'ignore')
>>> x == '', x is ''
(True, False)

The shared empty string is really an implementation detail, and not all functions use it.
(In this case, I found a function whose C implementation calls _PyString_Resize(&s, 0))

Now, PyPy could share the empty string for performance reasons.
We should make sure first that the *RPython* empty string is shared, otherwise gc 
pressure would be similar.
Benchmarks, always benchmarks...

----------
nosy: +afa
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1177>
________________________________________


More information about the pypy-issue mailing list