WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
250654
GraphicsLayer::removeAllChildren shouldn't be n^2
https://bugs.webkit.org/show_bug.cgi?id=250654
Summary
GraphicsLayer::removeAllChildren shouldn't be n^2
Ahmad Saleem
Reported
2023-01-15 13:16:06 PST
Hi Team, Usually reducing expensive calls are always better, so I just wanted to raise and get input whether we can do similar to improve performance or reach to similar idea: Blink Commit -
https://chromium.googlesource.com/chromium/blink/+/ea1156d6f005f978e4da707ef4e2060c2fc7151f
WebKit GitHub -
https://searchfox.org/wubkat/source/Source/WebCore/platform/graphics/GraphicsLayer.cpp#316
&
https://searchfox.org/wubkat/source/Source/WebCore/platform/graphics/GraphicsLayer.cpp#395
Just wanted to raise so if it is something worth implementing with the same idea, we can gain some performance point. Thanks!
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-01-22 13:17:18 PST
<
rdar://problem/104534645
>
Ahmad Saleem
Comment 2
2023-07-24 13:19:34 PDT
This compiles: void GraphicsLayer::removeAllChildren() { while (!m_children.isEmpty()) { auto curLayer = m_children.last(); ... _______________ NOTE - It seems 'removeFromParent' calls 'removeFromParentInternal()' and it seems to be using 'removeFirstMatching' rather than 'reverseFind' but don't know how to amend this part. void GraphicsLayer::removeFromParentInternal() { if (m_parent) { GraphicsLayer* parent = m_parent; setParent(nullptr); parent->m_children.removeFirstMatching([this](auto& layer) { return layer.ptr() == this; }); // |this| may be destroyed here. } } ______________
Chris Dumez
Comment 3
2023-10-03 14:23:42 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/18578
EWS
Comment 4
2023-10-03 17:36:06 PDT
Committed
268814@main
(106c4aae5f43): <
https://commits.webkit.org/268814@main
> Reviewed commits have been landed. Closing PR #18578 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug