Skip to content
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: refactoring in preparation for promises support #17689

Closed
wants to merge 3 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Dec 14, 2017

Some refactoring on FSReqWrap and After in node_file.cc in preparation for introducing Promises support. This PR does not add any of the Promises functionality, but it cleans up the implementation a bit to make introducing promises support easier.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

fs

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Dec 14, 2017
@jasnell
Copy link
Member Author

jasnell commented Dec 14, 2017

benchmarks show no significant performance loss...

$ cat ~/fsbench | Rscript benchmark/compare.R
                                            improvement confidence   p.value
 fs/bench-stat.js statType="fstat" n=200000     -6.30 %            0.3436614
 fs/bench-stat.js statType="lstat" n=200000     -1.06 %            0.8565513
 fs/bench-stat.js statType="stat" n=200000      -1.90 %            0.7226539

$ cat ~/fsbench | Rscript benchmark/compare.R
                             improvement confidence   p.value
 fs/bench-readdir.js n=10000      1.21 %            0.7938888

@jasnell
Copy link
Member Author

jasnell commented Dec 14, 2017

Separate FSReqWrap definition into a new node_file.h.

Add Reject and Resolve methods to encapsulate the callbacks and
make the constructor, destructor protected instead of private
in preparation to make FSReqWrap subclassable for the Promises
implementation.

Rework and simplify the After function slightly in preparation
for a refactor.

Introduce the node::fs namespace instead of using an anonymous
namespace for fs methods.
@jasnell
Copy link
Member Author

jasnell commented Dec 18, 2017

jasnell added a commit that referenced this pull request Dec 18, 2017
Separate FSReqWrap definition into a new node_file.h.

Add Reject and Resolve methods to encapsulate the callbacks and
make the constructor, destructor protected instead of private
in preparation to make FSReqWrap subclassable for the Promises
implementation.

Rework and simplify the After function slightly in preparation
for a refactor.

Introduce the node::fs namespace instead of using an anonymous
namespace for fs methods.

PR-URL: #17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Dec 18, 2017
PR-URL: #17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
jasnell added a commit that referenced this pull request Dec 18, 2017
PR-URL: #17689
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@jasnell
Copy link
Member Author

jasnell commented Dec 18, 2017

Landed in 2ca227f, c0d6327, 14ad0bd

@MylesBorins
Copy link
Member

This doesn't land cleanly on v9.x can you please backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants