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

src: store onread callback in internal field #26837

Closed
wants to merge 3 commits into from

Conversation

addaleax
Copy link
Member

This gives a slight performance improvement. At 2000 runs:

                                        confidence improvement accuracy (*)   (**)  (***)
net/net-c2s.js dur=5 type='buf' len=64        ***      0.54 %       ±0.16% ±0.21% ±0.27%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

This gives a slight performance improvement. At 2000 runs:

                                            confidence improvement accuracy (*)   (**)  (***)
    net/net-c2s.js dur=5 type='buf' len=64        ***      0.54 %       ±0.16% ±0.21% ±0.27%
@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 Mar 21, 2019
src/base_object-inl.h Outdated Show resolved Hide resolved
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Nice. I've been curious about doing something like this. Glad to see there's an actual benefit

@addaleax
Copy link
Member Author

@addaleax
Copy link
Member Author

v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
// This could be e.g. value->IsFunction().
CHECK_IMPLIES(typecheck != nullptr, ((*value)->*typecheck)());
Copy link
Member

Choose a reason for hiding this comment

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

Since typecheck is never nullptr currently, maybe change the CHECK_IMPLIES into a simple CHECK?

You could also remove the default template argument and have a second, single-arg InternalFieldSet() without a check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I’ve turned it into a simple CHECK and removed the nullptr default. We can always adjust this if we want.

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 26, 2019
@nodejs-github-bot
Copy link
Collaborator

@addaleax
Copy link
Member Author

Landed in 3018441

@addaleax addaleax closed this Mar 26, 2019
addaleax added a commit that referenced this pull request Mar 26, 2019
This gives a slight performance improvement. At 2000 runs:

                                            confidence improvement accuracy (*)   (**)  (***)
    net/net-c2s.js dur=5 type='buf' len=64        ***      0.54 %       ±0.16% ±0.21% ±0.27%

PR-URL: #26837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@addaleax addaleax deleted the onread-internal branch March 26, 2019 14:15
targos pushed a commit to targos/node that referenced this pull request Mar 27, 2019
This gives a slight performance improvement. At 2000 runs:

                                            confidence improvement accuracy (*)   (**)  (***)
    net/net-c2s.js dur=5 type='buf' len=64        ***      0.54 %       ±0.16% ±0.21% ±0.27%

PR-URL: nodejs#26837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit that referenced this pull request Mar 27, 2019
This gives a slight performance improvement. At 2000 runs:

                                            confidence improvement accuracy (*)   (**)  (***)
    net/net-c2s.js dur=5 type='buf' len=64        ***      0.54 %       ±0.16% ±0.21% ±0.27%

PR-URL: #26837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

5 participants