-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: refactor stats array to be more generic #19714
Conversation
Did you run |
Benchmark CI id is 149 (pending) |
I mean even just locally, just the subset that would be affected by this. |
@mscdex I only ran with
|
Benchmark results, interestingly there are some significant improvements in APIs that used to reference the global https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/149
|
cd00ad2
to
6b89621
Compare
Rebased to address the conflicts with the newly-applied spaced-comment eslint rules. |
- Pass kFsStatsFieldsLength between JS and C++ instead of using the magic number 14 - Pass the global stats array to the completion callback of asynchronous FSReqWrap similar to how the stats arrays are passed to the FSReqPromise resolvers - Abstract the stats converter and take an offset to compute the old stats in fs.watchFile - Use templates in node::FillStatsArray and FSReqPromise in preparation for BigInt intergration - Put the global stat array filler in node_internals.h because it is shared by node_file.cc and node_stat_watcher.cc
6b89621
to
6d47c53
Compare
CI is green, landing.. |
Landed in f7049a2, thanks! |
- Pass kFsStatsFieldsLength between JS and C++ instead of using the magic number 14 - Pass the global stats array to the completion callback of asynchronous FSReqWrap similar to how the stats arrays are passed to the FSReqPromise resolvers - Abstract the stats converter and take an offset to compute the old stats in fs.watchFile - Use templates in node::FillStatsArray and FSReqPromise in preparation for BigInt intergration - Put the global stat array filler in node_internals.h because it is shared by node_file.cc and node_stat_watcher.cc PR-URL: #19714 Reviewed-By: James M Snell <jasnell@gmail.com>
I have a WIP for BigInt integration of fs.Stats, which depends on the v8 6.7 update. This is part of the integration that does not depend on BigInt and does not change the API, but makes the related code more generic and reference less magic numbers and global variables.
magic number 14
asynchronous FSReqWrap similar to how the stats arrays are passed
to the FSReqPromise resolvers
old stats in fs.watchFile
for BigInt intergration
shared by node_file.cc and node_stat_watcher.cc
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes