0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/benchmark/fs/readFileSync.js
Brian White 6a5ab5d550 fs: include more fs.stat*() optimizations
Including:

* Move async *stat() functions to FillStatsArray() now used by the
sync *stat() functions

* Avoid creating fs.Stats instances for implicit async/sync *stat()
calls used in various fs functions

* Store reference to Float64Array data on C++ side for easier/faster
access, instead of passing from JS to C++ on every async/sync *stat()
call

PR-URL: https://github.com/nodejs/node/pull/11665
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-14 21:54:40 -07:00

18 lines
278 B
JavaScript

'use strict';
var common = require('../common.js');
var fs = require('fs');
var bench = common.createBenchmark(main, {
n: [60e4]
});
function main(conf) {
var n = +conf.n;
bench.start();
for (var i = 0; i < n; ++i)
fs.readFileSync(__filename);
bench.end(n);
}