benchmark: add benches for fs.stat & fs.statSync#8338
benchmark: add benches for fs.stat & fs.statSync#8338addaleax wants to merge 4 commits intonodejs:masterfrom
Conversation
benchmark/fs/bench-stat.js
Outdated
There was a problem hiding this comment.
Nit: doesn't this make the benchmark run n - 1 times?
There was a problem hiding this comment.
You’re right. I’ll fix this in the other tests, too.
Fix a off-by-one error that made the benchmarks for asynchronous functions run `n - 1` times instead of `n` times.
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks.
bff12fa to
82de541
Compare
|
LGTM |
|
LGTM. |
|
ping @mscdex |
benchmark/fs/bench-stat.js
Outdated
| fn(__filename, function() { | ||
| r(cntr); | ||
| }); | ||
| }(n)); |
There was a problem hiding this comment.
Perhaps we should be passing fn into the closure as well?
benchmark/fs/bench-stat.js
Outdated
|
|
||
| function main(conf) { | ||
| const n = conf.n >>> 0; | ||
| const fn = fs[conf.kind]; |
There was a problem hiding this comment.
I don't know how much it matters/affects things, but maybe we should change this variable name to avoid shadowing?
There was a problem hiding this comment.
I’ve simply replaced the only use of this variable with fs[conf.kind]. It doesn’t seem to make any difference, and I would expect any difference it makes to be pretty weak in comparison to the cost of the actual syscall/thread pool operation.
|
LGTM |
Fix a off-by-one error that made the benchmarks for asynchronous functions run `n - 1` times instead of `n` times. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
|
Landed in efabc6a and 450ee63 |
|
@jasnell Thanks for landing this! |
Fix a off-by-one error that made the benchmarks for asynchronous functions run `n - 1` times instead of `n` times. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
|
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport |
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Add very simple benchmarks for `fs.stat` and `fs.statSync` as well as `fs.lstat` and `fs.lstatSync` based on the `readdir` benchmarks. PR-URL: #8338 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
benchmark
Description of change
Add very simple benchmarks for
fs.statandfs.statSyncas well asfs.lstatandfs.lstatSyncbased on thereaddirbenchmarks.Linter run: https://ci.nodejs.org/job/node-test-linter/4005/