Last Comment Bug 760954 - View source slower in Firefox 15 (hangs with high cpu for seconds) on some (many?) HTML pages
: View source slower in Firefox 15 (hangs with high cpu for seconds) on some (m...
Status: VERIFIED FIXED
: perf, regression, testcase
Product: Toolkit
Classification: Components
Component: View Source (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla15
Assigned To: Simon Montagu :smontagu
:
: J. Ryan Stinnett [:jryans] (use ni?)
Mentors:
Depends on:
Blocks: 751841
  Show dependency treegraph
 
Reported: 2012-06-03 02:30 PDT by Nickolay_Ponomarev
Modified: 2012-07-25 11:10 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
fixed


Attachments
original page demonstrating the slowdown (217.75 KB, text/html)
2012-06-03 02:30 PDT, Nickolay_Ponomarev
no flags Details
testcase 1: many lines (39.45 KB, text/html)
2012-06-03 02:34 PDT, Nickolay_Ponomarev
no flags Details
testcase 2: single line, but many entity references (26.32 KB, text/html)
2012-06-03 02:34 PDT, Nickolay_Ponomarev
no flags Details
Patch (761 bytes, patch)
2012-06-03 04:55 PDT, Simon Montagu :smontagu
no flags Details | Diff | Splinter Review
Correct diff (1.34 KB, patch)
2012-06-03 04:57 PDT, Simon Montagu :smontagu
no flags Details | Diff | Splinter Review
Correct diff (787 bytes, patch)
2012-06-03 05:00 PDT, Simon Montagu :smontagu
ehsan: review+
Details | Diff | Splinter Review

Description Nickolay_Ponomarev 2012-06-03 02:30:38 PDT
Created attachment 629576 [details]
original page demonstrating the slowdown

STR: open attached file, select Tools -> Web developer -> Page source (Cmd+U).

Actual results: the page source is empty for a few seconds, during which Firefox uses 100% cpu doing reflow.

Expected results: view source should display as fast as in Firefox 14.

Regression window points to bug 751841:

Good: http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-inbound-macosx64/1338359573/firefox-15.0a1.en-US.mac.dmg
(built from http://hg.mozilla.org/integration/mozilla-inbound/rev/b613ac5ff64a)

Bad: http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-inbound-macosx64/1338360714/firefox-15.0a1.en-US.mac.dmg
(built from http://hg.mozilla.org/integration/mozilla-inbound/rev/e98f0fc3d02e)

According the the built-in profiler, with the patch we spend 4.5 seconds on my machine under PresShell::DoReflow, whereas before the patch it was 1 second.

I tried to simplify the page and I see the slowdown with
1) a long line with entity references (")
2) many lines, with or without entity references
Comment 1 Nickolay_Ponomarev 2012-06-03 02:34:23 PDT
Created attachment 629578 [details]
testcase 1: many lines
Comment 2 Nickolay_Ponomarev 2012-06-03 02:34:58 PDT
Created attachment 629579 [details]
testcase 2: single line, but many entity references
Comment 3 Simon Montagu :smontagu 2012-06-03 04:55:04 PDT
Created attachment 629592 [details] [diff] [review]
Patch

This possibly needs to be split into two bugs, something like a) performance is bad with lots of elements with unicode-bidi: isolate; b) view-source uses lots of elements with unicode-bidi: isolate.

This is a patch for b), i.e. it fixes the issue with view-source slowdown, but there could be similar slowdown in other cases.
Comment 4 Simon Montagu :smontagu 2012-06-03 04:57:05 PDT
Created attachment 629593 [details] [diff] [review]
Correct diff
Comment 5 Simon Montagu :smontagu 2012-06-03 04:58:16 PDT
I have *no* clue where that first hunk is coming from :(
Comment 6 Simon Montagu :smontagu 2012-06-03 05:00:56 PDT
Created attachment 629594 [details] [diff] [review]
Correct diff
Comment 7 :Ehsan Akhgari 2012-06-04 09:43:06 PDT
I went ahead and landed the patch: http://hg.mozilla.org/mozilla-central/rev/42f8002ca13b
Comment 8 Nickolay_Ponomarev 2012-06-05 14:52:16 PDT
Thanks for the quick fix! The issue is now fixed for me.

Note You need to log in before you can comment on or make changes to this bug.