3 ms·
> and in the case of string concatenation, can be faster myth: http://jsperf.com/array-join-vs-string-connect/37 http://jsperf.com/array-join-vs-string-connect
by ricardobeat 13y ago
> and in the case of string concatenation, can be faster
myth: http://jsperf.com/array-join-vs-string-connect/37 http://jsperf.com/array-join-vs-string-connect/37
- FreeFull 13y agoIn Firefox 25 on Linux, Array Join Nocopy seems to perform the fastest.
- warfangle 13y agoExactly. I rarely build up an array within a loop and then join it. That kind of thing just seems dirty - use a buffer! It's usually, e.g., ['some string ', someVar, ' some rest of string'].join('');
- warfangle 13y agoIn some cases, nocopy join is faster. Thus. "Can be" faster. But most people do string concatenation in situations where performance of the concatenation really doesn't quite matter so much. I optimize for readability, understandability, and prevention of stupid silly mistakes first. Performance comes later.