WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 118322
118891
Make PerformanceTests/Layout/line-layout.html 2.6-2.9% faster
https://bugs.webkit.org/show_bug.cgi?id=118891
Summary
Make PerformanceTests/Layout/line-layout.html 2.6-2.9% faster
Ryosuke Niwa
Reported
2013-07-18 22:06:36 PDT
Merge
https://chromium.googlesource.com/chromium/blink/+/5d93a708887e75f0157ed95ecdea9dfd1b2b4a09
I was looking at this performance test in pprof or an unrelated reason and noticed that we were spending 2% of our time clearing a Vector. Rather than clearing the Vector, we can just set its size to 0 and avoid calling malloc and free for each iteration of the loop. The Vector is held in a local variable, so we'll reclaim its storage when the function returns.
Attachments
Perf difference (2.65-2.96%)
(25.45 KB, text/html)
2013-07-19 00:50 PDT
,
Ryosuke Niwa
no flags
Details
More diff
(27.96 KB, text/html)
2013-07-19 01:39 PDT
,
Ryosuke Niwa
no flags
Details
Adding more clear() calls
(31.70 KB, text/html)
2013-07-19 01:57 PDT
,
Ryosuke Niwa
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2013-07-18 22:07:00 PDT
<
rdar://problem/14489987
>
Ryosuke Niwa
Comment 2
2013-07-19 00:50:33 PDT
Created
attachment 207062
[details]
Perf difference (2.65-2.96%)
Ryosuke Niwa
Comment 3
2013-07-19 00:51:29 PDT
This is crazy because m_boxes is always empty (!!!), meaning that our implementation of Vector::clear() performs significantly worse than Vector::reset(0).
Ryosuke Niwa
Comment 4
2013-07-19 01:39:52 PDT
Created
attachment 207067
[details]
More diff Increasing the inline capacity to 64 didn't have any effect as expected. Apparently this code is insanely hot. Just adding the code in clear() reduces the perf. win to 1.86%: inline void TrailingObjects::clear() { m_whitespace = 0; m_boxes.resize(0); if (m_boxes.size() > 200000) m_boxes.clear(); } This is shockingly terrifying.
Ryosuke Niwa
Comment 5
2013-07-19 01:53:53 PDT
I've confirmed that the perf. gain comes from optimizing the text node path. This is frightening.
Ryosuke Niwa
Comment 6
2013-07-19 01:57:07 PDT
Created
attachment 207071
[details]
Adding more clear() calls Adding 3 more (hopefully) no-op clear() calls to the text node path worsens the result by roughly 5%.
Geoffrey Garen
Comment 7
2013-07-19 10:54:17 PDT
I believe this is covered by
https://bugs.webkit.org/show_bug.cgi?id=118322
.
Ryosuke Niwa
Comment 8
2013-07-25 17:34:30 PDT
*** This bug has been marked as a duplicate of
bug 118322
***
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