Created
September 25, 2018 15:27
-
-
Save jorangreef/3eb9ee456cb484784bb094e11de9f7d1 to your computer and use it in GitHub Desktop.
fs.fstat()
This file contains hidden or 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
var fs = require('fs'); | |
function callback(error) { | |
if (error) { | |
console.error(error); | |
process.exit(1); | |
return; | |
} | |
if (++count >= 1000000) { | |
console.log((Date.now() - now) + 'ms'); | |
process.exit(); | |
return; | |
} | |
fs.fstat(fd, callback); | |
} | |
var file = 'bench-fs-fstat'; | |
fs.writeFileSync(file, ''); | |
var fd = fs.openSync(file, 'r'); | |
var now = Date.now(); | |
var count = 0; | |
var concurrent = 32; | |
while (concurrent--) fs.fstat(fd, callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment