-
Notifications
You must be signed in to change notification settings - Fork 30k
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
benchmark: obj property access benchmark #11611
Conversation
Benchmark that compares the obj property access patterns being used in core today. Specifically comparing the two patterns: ```js function A() {}; function B() {}; var obj = {A, B, C: 1}; ``` and ```js function A() {} function B() {} var obj = {}; obj.A = A; obj.B = B; obj.C = 1; ```
Am I the only one who is not a fan of including all those ES microbenchmarks in core? And now feeling a bit of trepidation about stuff like this in the These all might be useful benchmarks, but I wonder if they might be better in some separate benchmarking repo. I'd prefer the benchmarks bundled with core source be restricted to tracking actual node performance of actual core code in ways it will be used by actual end users. Good benchmark to include in core: How many simultaneous http connections can we serve? Less good IMO: Which of these two tiny contrived fixture modules is faster? The results of this benchmark might be valid. Or real world results might vary quite a bit depending on use case. Because we never really know about the latter, I'd prefer we stick to benchmarking our actual use cases. Also, if this is going to cause a bunch of code churn for an improvement that isn't actually measurable in real code, then it may be creating more problems than it's solving. If this is all just me and everybody else thinks including these types of benchmarks is somewhere between harmless and awesome, I will be a team player about it. :-D |
These are minimal impact (there's no harm in having them here) and they allow us to track the performance tradeoffs of code styles and language features that are actively used within core. They allow us to make better decisions about what kind of changes to land and when. I'd prefer to keep them... but then again, I'm the one that opened the PR so that part should be obvious :-) |
@nodejs/benchmarking @mscdex Thoughts on this? |
for (i = 0; i < n; i++) { | ||
A(); | ||
B(); | ||
obj.C; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have this if it's the same in both direct/indirect cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which specifically? The obj.C
bit? Basically checking any accumulative effect. It may not make sense to keep tho :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. by accumulative effect, I mean I want to measure the performance of all the accesses on the different module patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the obj.C
is what I'm referring to.
Benchmark that compares the obj property access patterns being
used in core today. Specifically comparing the two patterns:
and
@mscdex @nodejs/benchmarking
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
benchmark