-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Closed
Labels
benchmarkIssues and PRs related to the benchmark subsystem.Issues and PRs related to the benchmark subsystem.bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
(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):
#!/bin/bash
VERSIONS="4.2.1 0.12.7 0.10.40 2.5.0 3.0.0 3.1.0"
fallocate -l 2000000000 file.dat
for i in 0 1 2 3 4 5; do
for v in $VERSIONS; do
nave use $v node spawn.js
done
donespawn.js:
var spawn = require('child_process').spawn
var FILE = process.argv[2] || 'file.dat'
var SIZE_MB = 2000
spawnPipe(function(err, time) {
if (err) return console.error(err.stack || err)
console.log([process.version, time].join(','))
})
function spawnPipe(cb) {
var bytesRead = 0
var time = process.hrtime()
var cat = spawn('cat', [FILE], {stdio: ['ignore', 'pipe', 'ignore']})
cat.stdout.on('data', function(data) {
bytesRead += data.length
})
cat.on('error', cb)
cat.on('close', function(code) {
if (code !== 0) return cb(new Error('cat exited with: ' + code))
if (bytesRead != SIZE_MB * 1000 * 1000) return cb(new Error('Incorrect bytes read: ' + bytesRead))
var diff = process.hrtime(time)
cb(null, SIZE_MB / (diff[0] + diff[1] / 1e9))
})
}Metadata
Metadata
Assignees
Labels
benchmarkIssues and PRs related to the benchmark subsystem.Issues and PRs related to the benchmark subsystem.bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
