Skip to content

Conversation

@BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Sep 19, 2017

This is a alternative to #12105 by @mscdex. I copied some of his stream changes - so those attributions go to @mscdex!

It does not depend on any data copying and is not blocked therefore. The benchmarks I ran against that PR were either on par or better, even though the numbers are not huge due to the v8 changes since that PR was opened.

I still have to add and run more benchmarks but I wanted to have some eyes on this already.

In general the only change that could be considered breaking is the function inlining and the direct usage of the bindings. Therefore monkey patching (as e.g. done in some tests that I removed for now) is not possible anymore. Please note that some functions used bindings directly before and some did not! I split those changes in individual commits. So I can also split this PR into multiple ones but I wanted to have a single one with all changes for the results.

One question is if we want to keep the bindings monkey patchable for our tests or not.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

fs, streams, buffer

Also change a few var to const
The main changes are
- combine errorHandler and nullCheck
- remove getOptions and copyObject
- improve callback handling
- improve flags handling
- improve writeFile and instanceOf checks
- improve read- and writestream
- improve path check
- inline functions if possible
- var to const

The code got also cleaned up in the process
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Sep 19, 2017
@BridgeAR BridgeAR added the performance Issues and PRs related to the performance of Node.js. label Sep 19, 2017
@jasnell
Copy link
Member

jasnell commented Sep 19, 2017

Great to see this but just a heads up, there are likely to be some conflicts with the fs-promises PR I'm working on currently (looking to open that PR either tomorrow or thursday). I'll ping you when I do.

@BridgeAR BridgeAR added buffer Issues and PRs related to the buffer subsystem. fs Issues and PRs related to the fs subsystem / file system. stream Issues and PRs related to the stream subsystem. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels Sep 19, 2017
@BridgeAR
Copy link
Member Author

BridgeAR commented Feb 7, 2018

Since fs has significantly changed since this PR and I do not have the time to pick this up anytime soon, I am going to close it.

@BridgeAR BridgeAR closed this Feb 7, 2018
@BridgeAR BridgeAR deleted the improve-fs branch April 1, 2019 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buffer Issues and PRs related to the buffer subsystem. fs Issues and PRs related to the fs subsystem / file system. performance Issues and PRs related to the performance of Node.js. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants