From 7aeeee3276f2bb0138c5d5a00b09fb2d44f70f92 Mon Sep 17 00:00:00 2001 From: Sorin Baltateanu Date: Thu, 21 Jul 2016 14:08:28 +0300 Subject: [PATCH] benchmark: repair the fs/readfile benchmark PR-URL: https://github.com/nodejs/node/pull/7818 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- benchmark/fs/readfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index f58550fae83f96..9fc8316743e285 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -22,8 +22,10 @@ function main(conf) { data = null; var reads = 0; + var bench_ended = false; bench.start(); setTimeout(function() { + bench_ended = true; bench.end(reads); try { fs.unlinkSync(filename); } catch (e) {} process.exit(0); @@ -41,7 +43,8 @@ function main(conf) { throw new Error('wrong number of bytes returned'); reads++; - read(); + if (!bench_ended) + read(); } var cur = +conf.concurrent;