-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: simplify native_immediate_callbacks #19339
Conversation
- Use std::list instead of std::vector because we do not need random access. - Use list.erase instead of moving elements then resizing to remove the first n elements in the list for simplicity and avoiding reallocation.
Did you benchmark this? Using a |
@addaleax I didn't. Should I use the HTTP2 benchmark (looks like that's where the native immediates are extensively used) or create an addon benchmark like |
Hm … an addon benchmark sounds like a lot of work for something like this, but I’m not sure that any particular subsystem uses this enough to reflect significant changes. (which might also mean that it probably doesn’t quite matter that much anyway… 😄 ) |
Started a HTTP2 benchmark: https://ci.nodejs.org/job/benchmark-node-micro-benchmarks/140 |
@joyeecheung It seems hard to write an addon benchmark, because getting addon and core ABI align is tricky due to all the flags we have, and because this patch itself switches the ABI… here’s what I’ve come up with by I’m getting about 44 Mops/sec with the current implementation, and about 19.5 Mops/sec with this PR. I’d leave it to you to make the call to say whether this is worth it, given that it doesn’t seem to affect the actual application code all that much. But generally, if you have ideas for how to actually get that benchmark (or one like it) into core, that would be cool. 😄 |
random access.
remove the first n elements in the list for simplicity and
avoiding reallocation.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes