Comment #7 on issue 3480 by [email protected]: V8 Array.join performance
regression
http://code.google.com/p/v8/issues/detail?id=3480
This only reproduced in Chrome. The reason is that Blink converts V8
strings to external strings when it uses them. However, the fast path
in %_FastAsciiArrayJoin only deals with sequential Ascii strings. So as
soon as Blink uses the string, it becomes slow when used for Array.join.
This is not a regression, but probably due to some change in Chrome. Not
sure if this regression has any real world implication, aside from
benchmarks with string literals. Adding handling of external strings
in %_FastAsciiArrayJoin would make this fast path bloated and even harder
to maintain.
As for arr.join(",") works 10-15 times faster than arr.join(" "), the
explaination is that V8 canonicalizes single-character strings. So when
a " " was externalized once somewhere, it changed the canonical " "-string.
Further uses of " " are all externalized, and we get off the fast path that
is %_FastAsciiArrayJoin.
A quick fix would be to prevent strings with length 1 from being
externalized. That would make sure that externalizing strings will not
interfer with canonical single-character strings. Given the short length it
probably won't affect anything else, performance-wise.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.