Re:JavaScript performance and a Webkit hotspot
by gorset on Monday May 02, 2011 @05:13PM
(#2507867)
Appending to a immutable string in a loop is O(n^2). I'm surprised the author is surprised by this. Python and Java is the same.
Sure, it's possible for the vm to optimize this by either using ropes or convert to a buffer based on some kind of code analysis, but you shouldn't bet on it.
Sure, it's possible for the vm to optimize this by either using ropes or convert to a buffer based on some kind of code analysis, but you shouldn't bet on it.