-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: add eventEmitter.once() benchmarks #912
Conversation
|
||
bench.start(); | ||
for (var i = 0; i < n; i += 1) { | ||
ee.emit('dummy'); |
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.
is this a very fair benchmark? after all, wouldn't any run after the first run be only to the .on()
listeners?
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.
What do you suggest?
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.
just throwing ideas at the wall, but i'm thinking some sort of Object.freeze()
(maybe deep-freeze) on the event emitter, which would (in non-strict mode) i believe silently fail when it is changed, leaving us the same object in each loop - thats the only idea that comes to mind that would only benchmark the .emit()
, what do you think?
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.
How do const
objects behave, would that do the job?
Right now, regarding these new benchmarks, I don't think most of them benchmark much. I don't really have any idea on how to fix that, but I don't think it's fair as-is. |
Well, at this point the benchmarks don't really matter unless #914 is merge-able. However as it stands, we need to know what kind of effect it will have on modules depending on |
@mscdex perhaps this should just be closed and reopened if it seems fit? |
Let's get @nodejs/benchmarking on this. |
No description provided.