-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Improve EventTarget performance #34120
Improve EventTarget performance #34120
Conversation
|
Benchmark: Before my changes: After my changes 😅 I think I have to make some changes |
|
The latest commit has some decent perf improvements: Based on @ronag comment I ditched the Listener class and the singular listener optimization and used an array of arrays (each inner array is a listener). I'm going to try replacing the inner array with an object next |
|
I tried using object inside the array and while it makes the code clearer it is about the same speed as the original code. I think the current improvement is going to be the best improvement for now |
|
@Ethan-Arrowood The numbers printed in the benchmark logs are in |
😂 oh whoops! Okay hmm so the array version is not better, and my first attempt was only marginally better 🤔 |
This reverts commit 89ba8d4.
|
I'm going to leave this open so others can comment, but I do believe focussing on spec compliance is better right now. Will open a new issue and begin work on that shortly. |
|
To be honest, I really wouldn't expect the array version to be faster than the linked list here, and the linked list is already optimized for the single listener case. There are definitely performance improvements that can be made but I don't think this is it. |
|
Yeah I agree! Do you think I should close this PR? I already have another branch focussing on adding the WPT stuff |


Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesWork in progress PR for improving performance of EventTarget by optimizing for singular handlers and then utilizing an array rather than a linked list.
Closes #34074