| Summary: | Introduce a fast path for replacing an attribute event listener | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Alexey Shvayka <ashvayka> | ||||||||||
| Component: | DOM | Assignee: | Alexey Shvayka <ashvayka> | ||||||||||
| Status: | RESOLVED FIXED | ||||||||||||
| Severity: | Normal | CC: | cdumez, esprehn+autocc, ews-watchlist, kangil.han, webkit-bug-importer, ysuzuki | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=235658 https://bugs.webkit.org/show_bug.cgi?id=236618 |
||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Alexey Shvayka
2021-12-17 14:14:00 PST
Created attachment 447474 [details]
Patch
Created attachment 447475 [details] Microbenchmark r287168: 618ms patch: 237ms (2.6x faster) (50 runs) Created attachment 447476 [details] Patch for running Speedometer2/Inferno-TodoMVC locally r287168 === score: 370.16 median: 372.38 patch === score: 385.03 (4% faster) median: 387.87 (4.16% faster) Median of 8 runs of `Tools/Scripts/run-perf-tests --repeat=4 --test-runner-count=30 PerformanceTests/Speedometer --no-build --release --no-show-results` with "inferno-todomvc-tests.patch" applied. Comment on attachment 447474 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=447474&action=review r=me > Source/WebCore/bindings/js/JSEventListener.cpp:86 > + m_jsFunction = JSC::Weak<JSC::JSObject>(jsFunction); m_jsFunction = JSC::Weak { jsFunction }; Should work and is more concise. > Source/WebCore/bindings/js/JSEventListener.h:88 > +template<class JSMaybeErrorEventListener> nit: I think we usually use "typename" instead of "class". Same comment below in this file. > Source/WebCore/dom/EventTarget.cpp:166 > + DOMWrapperWorld& isolatedWorld = worldForDOMObject(jsEventTarget); auto& ? This is awesome! Created attachment 447548 [details]
Patch for landing
Account for review comments and set m_wrapper to prevent ASSERT failures.
(In reply to Chris Dumez from comment #4) > Comment on attachment 447474 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=447474&action=review > > r=me Thank you for review, Chris! All comments were addressed. I was worried this change may get rejected because it adds a bit of JSC / bindings stuff to the EventTarget, yet on the second thought EventTarget already has a notion of attribute event listeners, this patch just makes it more explicit. Committed r287293 (245445@main): <https://commits.webkit.org/245445@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447548 [details]. (In reply to Alexey Shvayka from comment #2) > Created attachment 447475 [details] > Microbenchmark > > r287168: 618ms > patch: 237ms (2.6x faster) > (50 runs) Sadly, this change regressed after the review and before it was landed, which should be fixed in https://bugs.webkit.org/show_bug.cgi?id=235658 (r?). |