Closed
Bug 263581
Opened 21 years ago
Closed 20 years ago
[FIX]Improve WrappedLinesAreDirty() code
Categories
(Core :: Layout, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha6
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
(Keywords: perf)
Attachments
(1 file, 1 obsolete file)
|
4.79 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
I had a patch to improve this in my tree based on some profile I did sometime,
and I just remembered it today (CVS conflicts can be useful, sometimes). Then I
noticed we had an XXX comment about this code, even.
| Assignee | ||
Comment 1•21 years ago
|
||
| Assignee | ||
Comment 2•21 years ago
|
||
Comment on attachment 161546 [details] [diff] [review]
Patch
The basic idea is to replace the "If this line is not dirty and has a dirty
continuation, dirty it" algorithm (which is indeed O(N^2)), with an "If this
line is not dirty and has a dirty continuation, dirty all the lines from here
to the continuation". This should be O(N), since only two passes will be made
on the lines involved, instead of one pass per line up to the dirty
continuation.
I'm not completely happy with DirtyLineIfWrappedLinesAreDirty as a function
name, but couldn't think of a better one.
Attachment #161546 -
Flags: superreview?(dbaron)
Attachment #161546 -
Flags: review?(dbaron)
| Assignee | ||
Updated•21 years ago
|
Keywords: perf
Priority: -- → P2
Summary: Improve WrappedLinesAreDirty() code → [FIX]Improve WrappedLinesAreDirty() code
Target Milestone: --- → mozilla1.8alpha5
Comment 3•21 years ago
|
||
Might this have an impact on bug 142969 ?
| Assignee | ||
Comment 4•21 years ago
|
||
No idea. That bug has a lot of discussion about not much, with no profile data
to back it up.
Comment on attachment 161546 [details] [diff] [review]
Patch
r+sr=dbaron, although I'm not sure the logic here makes sense (why only the
continuations before what's currently marked dirty?) -- but it's equivalent to
the old code.
It might be worth a comment at the call site of the new function with a one
line description of what that call does.
Attachment #161546 -
Flags: superreview?(dbaron)
Attachment #161546 -
Flags: superreview+
Attachment #161546 -
Flags: review?(dbaron)
Attachment #161546 -
Flags: review+
| Assignee | ||
Comment 6•20 years ago
|
||
> why only the continuations before what's currently marked dirty?
I suppose we could look forward to the _last_ dirty continuation we have and
dirty everything in between... I wasn't quite sure where in reflow to hook that
up, to be truthful. The current code will still fail for the case when all
lines following the line in question are clean (so it'll be O(N^2) in the number
of lines between the last dirty line and the end of the block). Would it be OK
to pre-dirty all lines with dirty continuations before we enter the reflow loop?
Or can continuations become dirty while we're in the loop?
I'd be happy to do a followup patch to make this better yet, if someone can
answer those questions...
Target Milestone: mozilla1.8alpha5 → mozilla1.8alpha6
> Would it be OK to pre-dirty all lines with dirty continuations before we enter
> the reflow loop? Or can continuations become dirty while we're in the loop?
The current line can become dirty inside the loop, but future lines cannot, so
it wouldn't affect the behaviour of your function. I think it would be safe to
handle this situation by traversing the lines backwards in a single pass before
entering the loop.
| Assignee | ||
Comment 8•20 years ago
|
||
Attachment #161546 -
Attachment is obsolete: true
| Assignee | ||
Comment 9•20 years ago
|
||
Comment on attachment 166996 [details] [diff] [review]
Do it all outside the loop
So like so?
Attachment #166996 -
Flags: superreview?(roc)
Attachment #166996 -
Flags: review?(roc)
Comment on attachment 166996 [details] [diff] [review]
Do it all outside the loop
Yeah, except that you need to process the first line too
Comment on attachment 166996 [details] [diff] [review]
Do it all outside the loop
oops, you do
Attachment #166996 -
Flags: superreview?(roc)
Attachment #166996 -
Flags: superreview+
Attachment #166996 -
Flags: review?(roc)
Attachment #166996 -
Flags: review+
| Assignee | ||
Comment 12•20 years ago
|
||
Checked in followup patch too. It seemed to help Tp on btek some...
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Product: Core → Core Graveyard
Updated•7 years ago
|
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•