-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 Performance of EventTarget #34074
Comments
Nice! Yeah, it would be great if you could take a look at this in more detail. Some relevant discussion from yesterday: #34057 (comment) In particular, moving away from private properties and not using I don’t think this would necessarily involve C++… However, clever use of V8 |
Awesome! Whats the best way I can test performance of my changes? |
There should be a benchmark in the |
@Ethan-Arrowood This is my go-to test command (that produced the results I posted in that thread as well):
And for profiling, this is what I use (on Linux):
(You can probably adapt that quite easily for the |
Semi-meta: you are always welcome to get involved with that sort of change, we don't "own" that code (all the collaborators and project members do). I'm happy to help you figure out how to improve the performance of that code though:
I think the performance wins are probably:
|
Thank you all for the tips! Definitely excited to dig into this 😁 @benjamingr one of my goals is to get more involved in contributing so feel free to direct me towards other action items / issues related to EventTarget/AbortController |
@Ethan-Arrowood sure and thanks 🙏 , I think the biggest thing I started doing and then got stuck at is (manually porting) WPTs from wpt/dom/events to our test suite and making EventTarget pass them and going over the differences and figure out if our implementation is correct. This is relatively simple to do since it's only JS (no C++) and it's a "sink" (adding tests and changing one file event_target.js) (but to be fair the C++ stuff in Node is pretty straightforward once you get used to its quirks). My flow has been:
If you are on a slower computer where building takes more than a few seconds, you can also extract the relevant JS parts from event-target elsewhere, work on them and copy them back. Performance is also interesting but not really a big priority. There are a ton of action items in https://docs.google.com/document/d/19lEj6h1xDe1I2lEvW_HSoyYG1OfAJO2PLe4dNE7gJ0w/edit but I think the biggest ones that are accessible are:
These are all open tasks you can get involved with, |
Incredible, thank you! I think I'll start with some of this perf work first to familiarize myself with the current API then I'll dive in to spec compliant stuff. I can also break these action items into issues too so they can be tracked better later today |
PR above has some of my initial attempts + metrics. I don't know what kind of performance improvement we are looking for. My initial attempts are only showing marginal improvement (and some other attempts actually decreased perf), so it might be an indicator of @benjamingr comment:
Maybe I shelf this and focus on making EventTarget spec compliant first. |
Extracting an action item from the OpenJS World AbortController collaborator summit:
If its okay with @benjamingr and @jasnell (+ any other maintainers that are involved here) I'd like to give this a shot. I'm not sure if it involves just JS or some C++ as well; either way I'm interested in at least investigating and then hopefully improving!
I didn't find an existing issue for this, so if one exists please let me know!
The text was updated successfully, but these errors were encountered: