-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Pipe/stream performance regression after v2.5.0 #3477
Comments
Actually it's similar on OS X for these versions too (excluding v0.10.40 which is much faster due to whatever caused #3475) So v4.2.1 is at about 60% of the performance of v2.5.0 here |
If I had to guess, it would be the v8 changes that affected the Buffer implementation. |
Yeah, figured something like that. Obviously the work that went into v3.1.0 mitigated the drop in v3.0.0 somewhat (on Linux anyway), but as of v4.2.1 still not back near v2.5.0 performance. |
is this still an issue? |
I put a fair bit of work into creating a reproducible case there to be honest – can you not reproduce this? |
I narrowed it down using bisecting (that was a lot harder than thought), and I’m pretty certain for the v0.12 -> v3 jump the Buffer -> Uint8Array changes are, as already suggested, responsible. For the second jump from v3 to v4, that is the result of #2352, which fixed a memory leak and unnecessary copying here. |
I'm gona close this then, we can re-open if more progress is made but I think @trevnorris already squeezed about as much basic buffer perf out of V8 as was reasonably attainable at the time of the change(es). :/ Let's nail this to "a V8 limitation"... |
So @Fishrock123 what's the limitation? This doesn't seem to have had much research besides narrowing down the commit Seems kinda lame that we can't progress in performance over v2.5.0! |
I also thought one of the main purposes of the benchmarking group was to:
Has the benchmarking group looked at this at all? |
I'm showing a slight performance regression, but not as large a gap as you've shown.
Though, let's make a slight adjustment to the example script and run the test again: var bytesRead = 0
var time = process.hrtime()
var cat = spawn('cat', [FILE], {stdio: ['ignore', 'pipe', 'ignore']})
+ var cntr = 0
cat.stdout.on('data', function(data) {
+ if (++cntr > 100) {
+ gc(true)
+ cntr = 0
+ }
bytesRead += data.length
})
cat.on('error', cb) Results:
The additional impact GC has on node because of the switch to using typed arrays is known (issue #1671). |
Ooh, nice. So you think it's probably a GC issue? |
(if so, all good – it certainly looks like it considering you can eliminate the regression by gc'ing – so happy with this being closed as a specific case of #1671 👍 – thanks for the research @trevnorris!) |
(extracting from #3429)
Not sure if this is something that's well known and/or being worked on, but just in case it's not flagged somewhere: certain streams (pipes?) still appear (as of v4.2.1) to be at only 70% of the performance they were in v2.5.0 and prior.
Here's how the performance looks for different node.js versions reading from the stdout of a spawned
cat
process on a 2GB file (the results are similar for reading from stdin):Generated using bench.sh (after
npm install -g nave
):spawn.js:
The text was updated successfully, but these errors were encountered: