Hello Raymond, On Sat, Jun 19, 2004 at 03:40:07PM -0400, Raymond Hettinger wrote: > * resize self to be big enough for an ob_sized string How would you do that? I can't see how you can resize strings in-place, and if the strings are pre-allocated to have the correct length you only solve one side of the problem -- the copy overhead -- and not the other one -- allocating and deallocating larger and larger blocks of memory. Solving half the problem would already be nice. Note however that code everywhere expects strings to have characters in their ob_sval field, accessing it thought the PyString_AS_STRING() macro. You could fix that macro too, but you would have to carefully monitor the performance impact. > If this works out, it would be an innovation. The join([a,b]) versus > a+=b problem also exists in several other languages. AFAICT, Python > would have been the first to solve it. *cough* Psyco *cough* implementation versus language *cough* I don't think Python can pretend to have put a lot of research effort into its string objects. Someone mentioned C++'s ropes, for example. Moreover there are a number of papers out there about which kind of structures are best suited in which situations, which should probably be taken into account too. (Psyco uses over-allocated buffers.) Armin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4