Uh oh!
There was an error while loading. Please reload this page.
Extract out fs validation functions - #17682
Conversation
There was a problem hiding this comment.
If we're going to separate these out, would you mind using Error.captureStackTrace() to filter out the frame for the validation function.
e.g.
consterr=newerrors.TypeError('ERR_INVALID_ARG_TYPE','buffer',['Buffer','Uint8Array']);Error.captureStackTrace(err,validateBuffer);throwerr;jasnell
commented
Dec 14, 2017
I like this, but can we wait until #17667 lands then update to include those also? |
apapirovski
commented
Dec 14, 2017
Code LGTM but maybe benchmark it just to make sure nothing weirdly regresses. |
lpinca
commented
Dec 15, 2017
One thing I don't like is the removal of the last frame from the stack trace but I guess there is no other way if we want to keep the stack trace the same as before. |
maclover7
commented
Dec 23, 2017
PTAL -- updated after @jasnell's PR landed |
apapirovski
commented
Dec 24, 2017
maclover7
commented
Dec 24, 2017
(no rush at all, but just waiting for a @jasnell approval before landing) |
jasnell
commented
Dec 27, 2017
still lgtm but I'd like to see a benchmark run. |
maclover7
commented
Dec 31, 2017
maclover7
commented
Dec 31, 2017
@jasnell running benchmark CI at https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/81/ (first time running that job -- let me know if I configured it wrong :) ) |
joyeecheung
commented
Jan 1, 2018
Benchmark results: There are a few performance hits in the stream throughput benchmarks that seem significant, although this PR does not seem to touch that part of code. I've started |
maclover7
commented
Jan 2, 2018
@jasnell@joyeecheung It looks like the second round of benchmarks are much better than the first... is a third run needed? Is this safe to land? |
joyeecheung
commented
Jan 3, 2018
New benchmark results do not show any significant impact, I think it's safe to land. |
apapirovski
commented
Jan 3, 2018
New run of benchmarks: https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/84/ The |
maclover7
commented
Jan 5, 2018
New benchmark results from https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/84/: @apapirovski Does this look okay to land? Effects do not appear very negative. |
joyeecheung
commented
Jan 11, 2018
Landed in 6e3818f...8aec363, thanks! |
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
PR-URL: #17682 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
maclover7
commented
Jan 13, 2018
Thank you for landing @joyeecheung!! |
evanlucas
commented
Jan 24, 2018
This isn't landing cleanly on v9.x. If it needs to be backported, can you please open a backport PR? Thanks! |
This touches a lot of code in fs and could make future backports difficult. With that being said it is a lot of churn. Should this be backported to |
Many different validations are repeated within
fs.js, so I extracted them out to separate functions to try and DRY up the code and avoid duplicating them.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
fs