-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Remove usage of PooledClass #9325
Comments
The person who wrote this code several years ago was likely worried about JS engine deoptimizations caused by using To be honest I think the whole Would you like to send a PR to remove it and rewrite the code that relies on it? We could then experiment with the result and see its effect on performance. |
It's worth noting that while modern browsers may optimize It's not a big deal if there is a small performance regression in a limited number of limited use browsers, but anything more would probably be worth considering more carefully. |
@aweary how would we go about doing that profiling? Is that something we could add to our fixture data? Or should that go somewhere else? |
Maybe, but it would be less clear what was passing and failing behavior. I imagine you'd have to write an app that taxed |
The whole issue with |
Okay, that works. As far as I know, object pooling is done to limit object allocations when possible. In that case, we should benchmark on low-memory devices to see if removing |
I'm not really sure what kind of benchmark could show it. |
My proposal: let's remove pooling from |
I can handle it unless someone else really wants to take it 😃 |
Renamed the issue to be more focused. Thanks @aweary! |
@aweary @gaearon If you consider removing usage of PooledClass from I have a work in progress branch for this. https://github.com/koba04/react/tree/remove-pooling-synthetic-event A commit is koba04@2ef294f |
Regarding But like I suggested elsewhere, multiple events of the same type are never really in-flight at the same time, so just keeping a single event should be enough, pooling should not be necessary. #1664 (comment) |
The approach I would like to try is to not use pooling for traversal, but to hardcode pooling implementation into the event system with less dynamic indirection. I think it would make sense to start with a single event object per type since each type might have different fields. We can later look if we can reduce it to one object overall. |
I've picked files depending on PooledClass. The following files are dependencies of Stack reconciler.
To remove PooledClass, we would need to consider about the following files. |
@gaearon how should we handle removing |
ping @gaearon, hoping you could provide some more guidance on ^ |
I’m mostly interested in looking at removing its occurrences in Fiber. Stack would be deleted soon anyway. |
@gaearon so in that case, it probably doesn't make sense to go through and remove |
Oh, we definitely don't want to do this in 15.x so you're right. |
Posted this issue in search for a good first bug but I started a beast here. |
Haha, sorry! I think we can close this because we removed its usage in the modern part of the codebase, and we’ll delete the legacy one very soon. |
I am too low in technology and have too many questions, but I want to know why
|
In PooledClass.js we have some static poolers based on the number of arguments & the comment specifies
it's not made dynamic so we don't have to use arguments.
I have 2 questions with this:
The text was updated successfully, but these errors were encountered: