Closed
Conversation
mscdex
suggested changes
Dec 8, 2020
Contributor
There was a problem hiding this comment.
One of the reasons for not using private fields yet is performance. They're still not as fast as normal properties or even Symbols:
confidence improvement accuracy (*) (**) (***)
fs/bench-opendir.js bufferSize=1024 mode='callback' dir='test/parallel' n=100 *** -11.08 % ±3.95% ±5.26% ±6.86%
fs/bench-opendir.js bufferSize=1024 mode='sync' dir='test/parallel' n=100 *** -11.78 % ±4.02% ±5.41% ±7.16%
fs/bench-opendir.js bufferSize=32 mode='callback' dir='test/parallel' n=100 *** -11.43 % ±5.15% ±6.86% ±8.93%
fs/bench-opendir.js bufferSize=32 mode='sync' dir='test/parallel' n=100 *** -15.40 % ±0.97% ±1.29% ±1.68%
fs/bench-opendir.js bufferSize=4 mode='callback' dir='test/parallel' n=100 *** -6.42 % ±3.65% ±4.86% ±6.33%
fs/bench-opendir.js bufferSize=4 mode='sync' dir='test/parallel' n=100 *** -14.61 % ±1.09% ±1.45% ±1.90%
confidence improvement accuracy (*) (**) (***)
fs/bench-readdir.js withFileTypes='true' dir='test/parallel' n=10 *** -12.21 % ±2.64% ±3.52% ±4.58%
fs/bench-readdirSync.js withFileTypes='true' dir='lib' n=10 *** -13.28 % ±5.36% ±7.14% ±9.33%
fs/bench-readdirSync.js withFileTypes='true' dir='test/parallel' n=10 *** -9.81 % ±3.70% ±4.92% ±6.40%
Member
Author
Thanks for the reply, I hadn't noticed the performance issue before, maybe we need to wait for the improvement from V8. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current thoughts are personal, feel free to point out problems if inappropriate!
Refactor lib/internal/fs/dir.js and lib/internal/fs/util.js to use private fields instead of symbols.
Reason:
When I see a Symbol, I need to look at the context to determine if the variable is just private or shared by internal. I think Symbol only do option 2 in the project, which will make the code easier to read.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes