Message1579
Of course the 'join' workaround is more correct in this particular case. But this inefficiency can affect other existing code which runs well on CPython. So in my opinion it should be considered as bug and not as implementation detail.
Actually the reference counting isn't needed as it's done by Java itself. What's needed optimize append operations:
1. Separate PyString and string storage. The storage will keep the char vector and PyString will be wrapper keeping (storage, start, length). The PyString will be still immutable while the storage can be mutable.
2. Use StringBuilder as the storage. This way append to the end of storage would be very cheap.
3. Copy on Write the storage when need to modify the internal characters.
These changes require approximately <100 lines of code and are localized in PyString.
As this doesn't add an additional indirection compared to current implementation probably the performance of other string uses will not be affected.
|
|
| Date |
User |
Action |
Args |
| 2008-02-20 17:17:48 | admin | link | issue1709162 messages |
| 2008-02-20 17:17:48 | admin | create | |
|