file `which node`
file `which d8`
node build defaults to x64 on x64 hosts while v8 build always defaults to ia32.
Fastest join happens when v8 manages to fit result of the join into
new space allocated string. See
http://code.google.com/p/v8/source/browse/trunk/src/array.js#411
http://code.google.com/p/v8/source/browse/trunk/src/ia32/full-codegen-ia32.cc#3372
On x64 new space is larger so %_FastAsciiArrayJoin succeeds, but on
ia32 it fails to allocate the result.
--
Vyacheslav Egorov
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
Indeed, that was exactly the case.
> Fastest join happens when v8 manages to fit result of the join into
> new space allocated string. See
> On x64 new space is larger so %_FastAsciiArrayJoin succeeds, but on
> ia32 it fails to allocate the result.
Indeed. With a x64 binary, I may also break FastAsciiArrayJoin by
adding an accented character to the string (like in "café"). Then, it
falls back to the JavaScript impl.
Regarding replace(/a/g,'b'), IMO the problem is the
ReplacementStringBuilder class. It first builds an array of *objects*
which are either strings or encoded offsets within strings. Then, it
merges it all into the actual result string.
In case we replace large spans within a string, that technique
probably optimizes something. If we just replace 'a' with 'b', then
all that typecasts, double-checks, encodings and decodings eat quite a
lot, compared to the actual work :)
--
Victor
On 29 August 2011 10:32, Victor Grishchenko