Closed
Bug 23187
Opened 26 years ago
Closed 20 years ago
document.write() is slow
Categories
(Core :: Layout, defect, P3)
Core
Layout
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: ekrock, Assigned: roc)
References
Details
(Keywords: perf, testcase)
Attachments
(4 files)
On WinNT 4.0 SP3, I get the following stopwatch timing results for loading a
page whose body contains only a for loop that does 1000 document.write()
statements:
Nav4.7 - 2 sec
IE5.5beta - 1 sec
M12 1999122023 - 15 sec
The performance of document.write() statements in SCRIPTs in the body must be
improved. Will attach test case.
Reporter | ||
Updated•26 years ago
|
Whiteboard: [TESTCASE]
Reporter | ||
Comment 1•26 years ago
|
||
Marking [TESTCASE].
Reporter | ||
Comment 2•26 years ago
|
||
Vidur, I'll leave it to you to decide whether this is because of DOM, the
content model, or the lack of batching for layout. If it is the later, then this
will be a good test case for Nisheeth
Updated•26 years ago
|
Assignee: vidur → nisheeth
Comment 4•26 years ago
|
||
The latter is probably the biggest culprit. I'll let Nisheeth hold onto it as a
performance test.
Updated•26 years ago
|
Keywords: perf
Summary: [PERF] document.write() is slow → document.write() is slow
Reporter | ||
Comment 5•26 years ago
|
||
Bulk moving [testcase] code to new testcase keyword. Sorry for the spam!
Keywords: testcase
Comment 6•26 years ago
|
||
Accepting bug and setting milestone to M14...
Status: NEW → ASSIGNED
Target Milestone: M14
Comment 7•26 years ago
|
||
Vidur, I'm re-assigning this to you so that you can close it out once you
checkin your content sink changes.
Assignee: nisheeth → vidur
Status: ASSIGNED → NEW
Comment 8•26 years ago
|
||
It's much faster than it was, but is it fast enough? What say Krock? I checked
in a fix to make it faster on 1/28/2000.
Status: NEW → ASSIGNED
Comment 9•25 years ago
|
||
Moving this one along to a later milestone. I think the performance is much more
reasonable now. The question is how good is good enough.
Target Milestone: M14 → M17
Comment 10•25 years ago
|
||
pardon me for bumping in here. I dropped by the BugAThon pages and found this
bug, and document.write() speed is an odd hobby of mine.
over on http://home.sol.no/~warnckew/programming/javascript/document.write.html
is some information about three tests I created about a year ago. I altered the
code slightly today so Mozilla M14 also runs it as it should. I didn't shut
down all applications before testing, but the result of a 150 table row test
with the fastest output method (string concatenation directly in the write())
was:
Communicator 4.72: 2800-2890ms
Mozilla M14: 2410-2530ms
IE 5.0: 550-600ms
if you guys are looking to improve the speed further than the current I'll
happily run it through all 9 tests I have (three different write methods and
three types of content) to see how it works out.
Comment 11•25 years ago
|
||
It's interesting to see that we're comparable to 4.72 in your test - my guess is
that the fact that it's a table is relevant. I think we should continue to look
at document.write speed, so more data would definitely be helpful. Thanks!
Comment 12•25 years ago
|
||
Comment 13•25 years ago
|
||
I ran Mozilla, IE5 and NC4.72 through all tests today. I wrote a test report in
HTML and uploaded it as an attachment.
Compared to NC4.72 the result is good for the first test, but Mozilla is
considerably slower on the two other tests. IE5 nails every test, in my
opinion.
What surprised me was the result of the second test when multiple
document.write()s are used. Mozilla suddenly spends 9 seconds, which is an
speed decrease compared to test #1, while the other browsers have a speed
increase. M14 is still not as bad as IE4 though, which used 24 seconds on that
test on a PII/266. :)
Overall Mozilla's performance is fair when the script is optimized for
performance.
Comment 14•25 years ago
|
||
This bug has been marked "future" because the original netscape engineer
working on this is over-burdened. If you feel this is an error, that you or
another known resource will be working on this bug,or if it blocks your work
in some way -- please attach your concern to the bug for reconsideration.
OS: Windows NT → All
Hardware: PC → All
Target Milestone: M17 → Future
Comment 15•25 years ago
|
||
The speed of any real world document.write() currently also depends on bug
61842, although the pure test case in THIS bug will probably not confirm this
because it uses a loop.
Bug 61842 deals with a shocking slowdown due to parsing of script that contains
HTML.
In other words: Even if the performance problem that this test case uncovers is
solved, then any real world application bug that use this bug for tracking might
not necessarily be resolved.
Depends on: 61842
Comment 16•24 years ago
|
||
Johnny would like to hold on to this one.
Assignee: vidur → jst
Status: ASSIGNED → NEW
Comment 17•23 years ago
|
||
what's the current status of this one?
Updated•23 years ago
|
Keywords: mozilla1.3
Comment 18•23 years ago
|
||
Here is two new testcases with a timer for this bug :
Test1 does 10000 document writes on body onLoad without HTML formatting:
for (i=0; i<10000; i++)
{ document.write (i+" ");
}
Test2 does 10000 document writes on body onLoad *with* HTML formatting:
for (i=0; i<10000; i++)
{
document.write ("<p>" + i + "</p>");
}
Setup : athlon 1700XP-256MB-WinXP-build 2002122808
Results :
Test1 Test2
Moz 0.969 12.141
IE6 0.375 0.437
The document.write loop is about 3x slower than IE6 with test1 but is about 28x
slower with test2 !
I believe that this second test (similar to the original testcase) is mainly
displaying a major layout performance issue which may not be related to
document.write.
Comment 19•23 years ago
|
||
Comment 20•23 years ago
|
||
![]() |
||
Comment 21•22 years ago
|
||
test2 becomes at least 3 times faster if the proposed patch in bug 145425 is
checked in (the one that makes us not do an O(N^2) walk over all the crap you're
writing).
Depends on: 145425
Updated•22 years ago
|
Keywords: mozilla1.3
Whiteboard: [TESTCASE]
Comment 22•22 years ago
|
||
bz, can you tell how much perf gain it will have on the testcase in bug
151461 ?
![]() |
||
Comment 23•22 years ago
|
||
None, as far as I can tell.
Comment 24•22 years ago
|
||
thx for checking!
then the perf bottleneck in bug 151461 is not document.write() - or?
Assignee | ||
Comment 25•22 years ago
|
||
I would like to have a look at this. Stealing.
Assignee: jst → roc+moz
Priority: P3 → P2
Assignee | ||
Updated•22 years ago
|
Priority: P2 → P3
Comment 26•20 years ago
|
||
Some current testing, on PentiumM 1.5Ghz, WinXp, 1GB RAM (Thinkpad T40):
IE6.0 Deerpark 20050720
Test1 0.40 0.45
Test2 0.46 0.75
So differences are becoming much less!
Comment 27•20 years ago
|
||
Actually, some re-testing (on 22/8/2005) results:
IE6.0 Deerpark 20050817 Deerpark20050821
Test1 0.38 0.37 0.38
Test2 0.73 0.78 0.72 (!)
So, we are very very close, or can we just say there now the same?
Notes:
* Deerpark20050821 has bug 243486 fixed (Lots of small document.write spend a
lot of time in cache code).
* IE6.0 was really: 6.0.2800.1106.xpsp2.05031-1526
Marking this one as FIXED (by bug 243486)
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment hidden (collapsed) |
You need to log in
before you can comment on or make changes to this bug.
Description
•