Closed zpao closed 3 years ago
:+1: We can also get rid of event.persist()
which has caused engineers to bang their heads against walls for years. I think the value of persistent events shouldn't be underestimated, so I'm in favor of doing this even at the cost of slowing down legacy browsers - so long as things are acceptable in the latest versions of browsers.
Yes, persist()
would go away naturally as a result (you'd be beholden to normal GC rules).
Yasss. This is a strong ergonomic improvement in general.
I agree that for desktop devices and some mobile use cases this will not be an issue. Though I strongly suspect that removing this will cause noticeable GC pauses in touchmove events or other gestures on mobile devices.
While building a previous project (few years old now) we ran into issues while generating a lot of garbage while transforming shapes with gestures on iOS. Considering that JSCore is generally more optimized on mobile than V8, I suspect this will be more noticeable on Android devices.
I’m still interested in seeing the reality of what the GC cost would be without pooling.
Is there something that causes non-persistent events to not satisfy the generational hypothesis the way it seems like they should?
Are the relevant GC pauses really in young gen?
Not all JS GCs work the same. This would optimize for a copying collector in which case this would be essentially free, except it might cause more frequent young GCs which should be fine. If the JS engine chose a different strategy that wouldn't be the case.
It's not about GC in general or whether the GC is optimized or not. It is whether it uses a copying collector specifically or not.
We did this in 17.
After staring at the confusing mess that is the synthetic event system today and talking with @sebmarkbage, we're no longer confident that we need the pooling that the system currently uses. GCs have gotten pretty good so we may be experiencing diminishing returns at this point, or maybe losing out on some benefits. We do have to consider that we still support some older browsers who's GCs don't have the benefit of the last several years worth of innovations so it might be premature, but it's probably worth investigating.