Closed
Bug 928403
Opened 12 years ago
Closed 12 years ago
nsFrameConstructorState::ProcessFrameInsertions is slow
Categories
(Core :: Layout, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: smaug, Assigned: smaug)
References
(Depends on 1 open bug)
Details
Attachments
(2 files, 2 obsolete files)
|
10.48 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
|
10.46 KB,
patch
|
Details | Diff | Splinter Review |
When opening the treeview in Gecko profiler and resizing the window,
nsLayoutUtils::DoCompareTreePosition(nsIFrame*,nsIFrame*...) takes over 85% of the time.
Under it GetPlaceholderFrameFor is about 50%.
I'm testing a simple placeholder cache if it helps with this case.
If not, perhaps we should keep placeholder member variable in frames?
| Assignee | ||
Comment 1•12 years ago
|
||
The cache doesn't seem to help.
| Assignee | ||
Comment 2•12 years ago
|
||
ok, so the problem is nsFrameConstructorState::ProcessFrameInsertions.
We end up calling CompareTreePosition a lot, and that calls FillAncestors.
Simple fix is to cache the result of FillAncestors for firstNewFrame,
but for other things...
One possibility would be to not do the linear search but binary or tree search or so when
going trough childList.
Summary: nsLayoutUtils::DoCompareTreePosition is slow → nsFrameConstructorState::ProcessFrameInsertions is slow
| Assignee | ||
Comment 4•12 years ago
|
||
| Assignee | ||
Comment 5•12 years ago
|
||
And the testcase is to create a profile using gecko profiler and alt+click the root arrow
(that expands the whole tree-view).
| Assignee | ||
Comment 6•12 years ago
|
||
Bug 928645 is annoying, but I think we should fix this even before that.
Or in other words, I don't have cycles to look at bug 928645.
| Assignee | ||
Comment 7•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=7795afa9001c
The hack for the old behavior isn't pretty, but easy to remove once
the other bug is fixed.
Attachment #819328 -
Attachment is obsolete: true
Attachment #819356 -
Flags: review?(dbaron)
| Assignee | ||
Comment 8•12 years ago
|
||
Comment on attachment 819356 [details] [diff] [review]
patch
Actually, since the code is originally from bug 217604, perhaps you
roc could review.
(I'm sure you remember what you did 10 years ago ;) )
Attachment #819356 -
Flags: review?(dbaron) → review?(roc)
Comment on attachment 819356 [details] [diff] [review]
patch
Review of attachment 819356 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsCSSFrameConstructor.cpp
@@ +1270,5 @@
> + nsIFrame* insertionPoint = nullptr;
> + int32_t imin = 0;
> + int32_t imax = children.Length() - 1;
> + int32_t imid = 0;
> + while (imax >= imin) {
I think it's a little clear if imax is exclusive; so set imax to children.Length() and make appropriate changes below.
| Assignee | ||
Comment 10•12 years ago
|
||
There was a reason why it was imax, not max ;)
But ok.
| Assignee | ||
Comment 11•12 years ago
|
||
This way then.
(to me this is harder to understand since we don't handle
boundary points the same way anymore. [min, max] vs [min, max) )
Attachment #819356 -
Attachment is obsolete: true
Attachment #819356 -
Flags: review?(roc)
Attachment #820294 -
Flags: review?(roc)
Comment on attachment 820294 [details] [diff] [review]
v2
Review of attachment 820294 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/base/nsCSSFrameConstructor.cpp
@@ +1271,5 @@
> + int32_t imin = 0;
> + int32_t imid = 0;
> + int32_t max = children.Length();
> + while (max > imin) {
> + imid = imin + ((max - imin) / 2);
declare imid here.
Attachment #820294 -
Flags: review?(roc) → review+
| Assignee | ||
Comment 13•12 years ago
|
||
| Assignee | ||
Comment 14•12 years ago
|
||
Comment 15•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•