Last active
November 1, 2015 22:14
-
-
Save speg/f09f6af8d4959575e4c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require('fs') | |
var bufferA = new Buffer(1e+8) | |
bufferA.fill(0) | |
var bufferB = new Buffer(1e+0) | |
bufferB.fill(0) | |
var fileA = fs.openSync('fileA', 'w') | |
var fileB = fs.openSync('fileB', 'w') | |
console.time('A') | |
fs.write(fileA, bufferA, 0, bufferA.length, function(err) { console.timeEnd('A')}) | |
console.time('B') | |
fs.write(fileB, bufferB, 0, bufferB.length, function(err) { console.timeEnd('B')}) | |
// expected output: B << A | |
// actual output on OS X node v5.0.0: | |
// A: 314.564ms | |
// B: 315.864ms | |
// Output on Linux: | |
// B: 4ms <-- yes! | |
// A: 306ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got this in Mac OS X and node 5.
A: 115.469ms
B: 116.775ms