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

Projects
None yet
5 participants
@addaleax
Copy link
Member

addaleax commented Mar 21, 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%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
src: store onread callback in internal field
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%
Show resolved Hide resolved src/base_object-inl.h Outdated
@jasnell
Copy link
Member

jasnell left a comment

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

@addaleax

This comment has been minimized.

Copy link
Member Author

addaleax commented Mar 21, 2019

@addaleax

This comment has been minimized.

Copy link
Member Author

addaleax commented Mar 21, 2019

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

This comment has been minimized.

@bnoordhuis

bnoordhuis Mar 21, 2019

Member

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.

This comment has been minimized.

@addaleax

addaleax Mar 26, 2019

Author Member

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

@nodejs-github-bot

This comment has been minimized.

@addaleax

This comment has been minimized.

Copy link
Member Author

addaleax commented Mar 26, 2019

Landed in 3018441

@addaleax addaleax closed this Mar 26, 2019

addaleax added a commit that referenced this pull request Mar 26, 2019

src: store onread callback in internal field
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 addaleax:onread-internal branch Mar 26, 2019

targos added a commit to targos/node that referenced this pull request Mar 27, 2019

src: store onread callback in internal field
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 added a commit to targos/node that referenced this pull request Mar 27, 2019

src: store onread callback in internal field
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 added a commit to targos/node that referenced this pull request Mar 27, 2019

src: store onread callback in internal field
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 added a commit that referenced this pull request Mar 27, 2019

src: store onread callback in internal field
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>

@targos targos referenced this pull request Mar 27, 2019

Merged

v11.13.0 release proposal #26949

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.