Open mathiasbynens opened 8 years ago
@bnoordhuis posted some excellent ideas here:
For example, .toASCII() calls String#split() twice and is heavy on the map-over-substrings idiom. It would probably be faster to: Scan for the split character and only split when found; saves allocating an array in the common case. Iterate rather than map; V8 is not great at lowering/inlining callbacks. Try to avoid concatenating strings too much; cons strings eventually have to be flattened. There is probably more but that is what stood out from a quick look.
For example, .toASCII() calls String#split() twice and is heavy on the map-over-substrings idiom. It would probably be faster to:
.toASCII()
String#split()
There is probably more but that is what stood out from a quick look.
Patches welcome.
cc @trevnorris
@bnoordhuis posted some excellent ideas here:
Patches welcome.
cc @trevnorris