Skip to content

Conversation

@joyeecheung
Copy link
Member

  • Cache args.Length()
  • Use value.As<T>() to cast the arguments
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • 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++. fs Issues and PRs related to the fs subsystem / file system. labels Jan 16, 2018
src/node_file.cc Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const int argc = ... if you're caching it. .Length() is really just an inexpensive pointer load though.

- Cache `args.Length()`
- Use `value.As<T>()` to cast the arguments
@joyeecheung
Copy link
Member Author

Rebased and updated with @bnoordhuis's suggestion.

CI: https://ci.nodejs.org/job/node-test-pull-request/12631/

@joyeecheung
Copy link
Member Author

joyeecheung commented Jan 20, 2018

Only one unrelated CI failure. Landed in e1c29f2, thanks!

joyeecheung added a commit that referenced this pull request Jan 20, 2018
- Cache `args.Length()`
- Use `value.As<T>()` to cast the arguments

PR-URL: #18192
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

This does not land cleanly on v9.x, would someone be willing to do a backport?

@joyeecheung
Copy link
Member Author

This is cleaning up the code mostly came from semver-major changes, so does not make too much sense to backport.

MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
- Cache `args.Length()`
- Use `value.As<T>()` to cast the arguments

PR-URL: nodejs#18192
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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++. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants