WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
224589
Avoid indirect load in ContainerNode::hasOneChild()
https://bugs.webkit.org/show_bug.cgi?id=224589
Summary
Avoid indirect load in ContainerNode::hasOneChild()
Ryosuke Niwa
Reported
2021-04-14 19:16:46 PDT
Getting nextSibling() will involve loading the first child into the register. Avoid that and just check m_firstChild and m_lastChild instead to avoid this extra memory load.
Attachments
Patch
(1.62 KB, patch)
2021-04-14 19:43 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2021-04-14 19:43:00 PDT
Created
attachment 426070
[details]
Patch
Chris Dumez
Comment 2
2021-04-14 19:47:33 PDT
Comment on
attachment 426070
[details]
Patch If you say this is more efficient, I believe you. R=me. The new code definitely still is correct.
Ryosuke Niwa
Comment 3
2021-04-14 19:52:44 PDT
(In reply to Chris Dumez from
comment #2
)
> Comment on
attachment 426070
[details]
> Patch > > If you say this is more efficient, I believe you. R=me. The new code > definitely still is correct.
Yeah because m_firstChild and m_lastChild are both in the same object whereas m_firstChild isn't. CPU needs to load the content of m_firstChild and then retrieve m_nextSibling, which is an indirect load that CPU will have a hard time predicting so whilst prefetched would detect this and will fetch it, it can still result in either TLB hit miss and/or L2/L3 cache misses, which would be horrifyingly expensive.
Ryosuke Niwa
Comment 4
2021-04-14 20:34:17 PDT
Comment on
attachment 426070
[details]
Patch Clearing flags on attachment: 426070 Committed
r275997
(
236549@main
): <
https://commits.webkit.org/236549@main
>
Ryosuke Niwa
Comment 5
2021-04-14 20:34:19 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6
2021-04-14 20:35:15 PDT
<
rdar://problem/76682121
>
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