Optimize for long strings
janturon opened this issue · 1 comments
janturon commented
I was thinking if var vector = new Array(2 * la)
would help instead of var vector = [];
? In theory arrays are created with predefined size and they are reallocated if that size is exceeded (with some new limit estimate). I don't know how the browsers optimize it today, but surely the length constructor exists for a reason.
gustf commented
That was my thought too and I have experimented with that, but V8 (at the time of writing) could optimize better with [] because it could then infer that only numbers was used and have the array optimized for numbers.