-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array Joining is slower in Node 6.x #9039
Comments
Added Node v6.7.0 for posterity |
Confirmed. I'm willing to bet this change is the culprit based on the comparison of output of /cc @nodejs/v8 ? |
@bmeurer is the fast path already landed? |
Nope. There was some work on Array.prototype.join, but that is on hold due to other priorities. |
How does Node 7 fare? |
@ronkorving I'm currently seeing master be ~6% faster than node v6 with a generic string join benchmark. FWIW here's the simpler benchmark I'm using: function foo(a, b, c) {
return [a,b,c].join(' ');
}
console.time('join');
for (var i=0; i<1e7; ++i)
foo('1', '2', '3');
console.timeEnd('join'); Results:
|
Trying to summarize the issue and find the path forward.. the issue is due to the removal of the hacky The V8 team has plans to implement a proper fast path for The other alternatively would be to revert the removal of I am not sure if it is worth it though (counter-arguments welcome). |
/cc @nodejs/lts |
In theory it'd be possible to reintroduce The long-term solution is to port all of Right now we don't have the bandwidth to work on the long-term vision for /cc @caitp Is this maybe something you'd be interested in? |
I may be able to work on that, but if there isn't evidence that this has an impact on real applications, then maybe it could wait until 2017? |
Here's the current situation on my machine:
|
This fell off my radar. If you throw me a design, I'll put some hours into it |
There has been no movement on this for a long time and it's a V8 issue, as such I'm going to go ahead and close this. Feel free to re-open if you feel I'm mistaken. |
It appears that joining together raw strings has some performance regressions in the 6.x line. I first noticed this when evaluating the
classnames
library for a project and running its benchmarks as my coworker on 5.9.0 was getting roughly double the speed I was getting with 6.6.0. But I've extracted the meat of the issue into a small sample test.When I asked on
#node-dev
about this I was suggested to test 5.11 -> 6.0 as well as 6.4 -> 6.5 as those were major bumps for V8 versions.The test requires
benchmark.js
, if someone could point me as to how to do a raw node benchmark this would be appreciated.Results of tests
node min-string-test.js Result: test-join-str x 8,037,676 ops/sec ±1.05% (92 runs sampled)
node min-string-test.js Result: test-join-str x 1,985,858 ops/sec ±1.71% (90 runs sampled)
node min-string-test.js Result: test-join-str x 2,120,274 ops/sec ±0.93% (94 runs sampled)
node min-string-test.js Result: test-join-str x 3,738,101 ops/sec ±0.92% (92 runs sampled)
node min-string-test.js Result: test-join-str x 3,710,874 ops/sec ±1.45% (92 runs sampled)
node min-string-test.js Result: test-join-str x 3,703,040 ops/sec ±0.98% (93 runs sampled)
The text was updated successfully, but these errors were encountered: