4 ms·
> In most cases, string concatenation is not going to be a performance issue, and then you never care about these details at all. I would have thought if the p
by chrisseaton 6y ago
> In most cases, string concatenation is not going to be a performance issue, and then you never care about these details at all.
I would have thought if the performance of anything in a language like Python mattered, it'd be how quickly you can build up a text response, like a JSON document or rendered HTML?
In my implementation of Ruby I use immutable ropes for strings - so instead of mutable arrays of characters I have persistent trees of immutable arrays of characters. This makes a massive literal 10x impact on real-world code like template rendering.
- jfkebwjsbx 6y agoThat depends on what you are building with the language. There are a lot of use cases outside web apps in Python. The majority of them, I'd argue.
- judofyr 6y agoThis is actually a good point. If you're never accessing inside a string directly, but only iterating over it, then it's often far better to build a tree/rope structure than to create a continuous memory section.