Closed
Bug 139384
Opened 23 years ago
Closed 23 years ago
Data URLs can take up to 10 minutes to Print (or more depending on the length)
Categories
(Core :: Printing: Output, defect)
Core
Printing: Output
Tracking
()
VERIFIED
FIXED
mozilla1.0
People
(Reporter: mcguirk, Assigned: rods)
References
Details
(Keywords: perf, Whiteboard: [adt2 RTM] [Needs a=] custrtm-)
Attachments
(1 file, 1 obsolete file)
5.80 KB,
patch
|
rods
:
review+
rods
:
superreview+
chofmann
:
approval+
|
Details | Diff | Splinter Review |
The code in nsPageFrame::DrawHeaderFooter to truncate the header to the length
that will fit on the page is extremely slow if a very long string happens to be
passed in.
For example, I have an application that embeds Gecko where I navigate to long
'data:' URLs. If I try to print without removing the URL from the header first,
and the URL is, say, 30k long, its width is recomputed approximately 30k times,
removing one character at a time. That hangs the machine for 5-10 minutes. It
would be much smarter to add up the width one character at a time starting from
the beginning; such an algorithm would be efficient with strings of any length.
![]() |
||
Updated•23 years ago
|
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: perf
OS: Windows 2000 → All
Hardware: PC → All
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Comment 1•23 years ago
|
||
The patch removes the n-order search for the length and reuses a funciton
"BinarySearchForPosition" code from the nsTextFrame for finding cursor
position. Instead of cursor position, it is just uses the available width.
This simplifies the code and makes it very fast.
Assignee | ||
Comment 2•23 years ago
|
||
I test this with no title and a very long title and a short title. Works great!
Assignee | ||
Comment 3•23 years ago
|
||
Since the diff is hard to decypher here is what the code looks like now:
nsAutoString str;
ProcessSpecialCodes(aStr, str);
PRInt32 indx;
PRInt32 textWidth = 0;
const PRUnichar* text = str.get();
PRInt32 len = (PRInt32)str.Length();
if (!len) {
return; // bail is empty string
}
// find how much text fits, the "position" is the size of the avilable area
if (BinarySearchForPosition(&aRenderingContext, text, 0, 0, 0, len,
PRInt32(contentWidth), indx, textWidth)) {
if (indx < len-1 && len > 3) {
str.SetLength(indx-3);
str.Append(NS_LITERAL_STRING("..."));
}
} else {
return; // bail if couldn't find the correct length
}
Assignee | ||
Updated•23 years ago
|
Summary: Slow computation of header width in nsPageFrame::DrawHeaderFooter → Data URLs can take up to 10 minutes to Print (or more depending on the length)
Comment 4•23 years ago
|
||
nsbeta1+
Comment 5•23 years ago
|
||
Comment on attachment 80940 [details] [diff] [review]
patch
r = dcone
Attachment #80940 -
Flags: review+
Comment 6•23 years ago
|
||
Comment on attachment 80940 [details] [diff] [review]
patch
sr=attinasi (though I really think the function BinarySearchForPosition should
be a static method on nsTextFrame, or at least put into the header so you don't
have to redeclare it - #include is your friend)
Attachment #80940 -
Flags: superreview+
Assignee | ||
Comment 7•23 years ago
|
||
Adding this patch with changes from reviewers comments we can eaily apply it to
the branch, I'll carry the r= and sr= forward
Attachment #80940 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Attachment #81132 -
Flags: superreview+
Attachment #81132 -
Flags: review+
Assignee | ||
Comment 8•23 years ago
|
||
fixed.
To verify print a page with no title, a very long title, a short title, and a
somewhat sizeable data url.
Assignee | ||
Comment 9•23 years ago
|
||
really fixed
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 10•23 years ago
|
||
Dan this should be working for you now....please verify...let us know...
thanks.
Comment 11•23 years ago
|
||
Sujay - Can you pls verify this one on the trunk? Also, any data you could
provide on the perf win would be great, too. thanks!
Comment 12•23 years ago
|
||
verified in 5/2 trunk build.
looks fine to me...I copied and pasted a lot of text into the <title> of
a document and then printed...printed in a reasonable amount of time
like any other document.
Status: RESOLVED → VERIFIED
Comment 13•23 years ago
|
||
Let's get this one in after RC2. adt1.0.0- [adt2 RTM]
Assignee | ||
Comment 14•23 years ago
|
||
ADT: low risk fix. If anyone prints and sizable data URL Mozilla begins to look
like it is hung.
Comment 15•23 years ago
|
||
Risk assessment from rods email, "small risk, well tested, big pay off in
performance ... reused some existing code to calculate the length of the page
title in order to chop it off to to fit." This has been verified by QA to fix
the bug.
Impact on User - Without this fix some data urls take 10 minutes to print.
Comment 16•23 years ago
|
||
Comment on attachment 81132 [details] [diff] [review]
patch with reviewer comments
a=chofmann for the 1.0 branch.
Attachment #81132 -
Flags: approval+
Comment 17•23 years ago
|
||
adding adt1.0.0+. Please get drivers approval again since this fix is more than
3 days old before checking this in to the 1.0 branch.
Updated•23 years ago
|
Whiteboard: [adt2 RTM] [Needs a= & ADT+] → [adt2 RTM] [Needs a=]
Comment 18•23 years ago
|
||
Re-approval granted; please checkin ASAP
Updated•23 years ago
|
Whiteboard: [adt2 RTM] [Needs a=] → [adt2 RTM] [Needs a=] custrtm-
You need to log in
before you can comment on or make changes to this bug.
Description
•