File/diff viewer is extremely computationally intensive and often yields unresponsive script warnings

RESOLVED FIXED in 4.x (triaged)

Status Graveyard
Admin/Editor Tools
6 years ago
2 years ago


(Reporter: kmag, Unassigned)


4.x (triaged)


(Whiteboard: [ReviewTeam])



6 years ago
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110513 Firefox/6.0a1
Build Identifier: 

For especially large files, the file/diff viewer takes an extraordinary amount of time to become responsive, often yielding several unresponsive script dialogs. Oddly, pressing Stop Script often leaves a seemingly feature-complete view of the file. Even smaller files often show a significant lag on page change.

The lyz.js file in the following package is an especially pronounced example:

Reproducible: Always
Looks like we're using (which is an enormous JS file).

I'm happy to hear alternatives or improvements.

Comment 2

6 years ago
I'm not sure that's the problem, because as far as I can tell, that only runs on diff pages and this also happens on non-diff pages. I initially thought it might be the syntax highlighting, but even stopping the script, everything appears to be highlighted properly. I'll have to see if I can get some more information out of Venkman.

Comment 3

6 years ago
Huh. Interesting. According to Firebug, diff_main() seems to be the main culprit (along with quite a lot of time spent in jQuery).
Ever confirmed: true
Priority: -- → P3
Whiteboard: [required amo-editors]
Target Milestone: --- → Q2 2011
The syntax highlighter we're using is

Are you saying it's our code or a libraries code that is being slow?
Target Milestone: Q2 2011 → 4.x (triaged)

Comment 5

6 years ago
I'm thinking that your first guess was right, given that the diff_main routine seems to be the main consumer, I just don't understand why that should be so. I can't really do much in the way of profiling on the production server, since all of the code there is compressed.

I does appear that something is wrong, though, given that the pages appear to display properly even after stopping the script.
scripts aren't compressed on

Comment 7

6 years ago
Hm. I tried there. I suppose that it's because the standard jQuery and diff distributions are shipped compressed that I got such unsatisfactory profiling output.

Comment 8

6 years ago

Is much faster, from bug 661947.

There's four parts: the diff (if relevant), the syntax highlighting, the line numbering, the diff bar.

In this case I sped up the line numbering an awful lot, that was the main problem with this file.
I think this has been fixed up since this bug, especially with the validation results patch landing.  -> fixed
Last Resolved: 6 years ago
Resolution: --- → FIXED

Comment 10

6 years ago
This is still a problem, although it's gotten somewhat better, I think. I still get unresponsive scripts several times a day.
I tried the link above and it was super fast.  Do you have any add-ons installed slowing it down maybe?  (just a thought).  Anyone else have the problem?
I almost never hit these warnings, but then again I don't review as much as Kris. Andrew, do you experience this problem often, or at all?

Comment 13

6 years ago
I'll provide a link the next time I see it. I think the file linked above was a special case.

Comment 14

6 years ago
This still causes problems for me:
Page took a couple seconds to load, but no warnings for me.

Comment 16

6 years ago
I should note that this is with a test profile with only a few trivial add-ons installed.

Comment 17

6 years ago
For me it spun my CPU for 20 seconds before I got the unresponsive script warning.

Comment 18

6 years ago
I should also note, to put this into perspective, that I was at the editors meeting and mine was one of the more powerful computers there.

Comment 19

6 years ago
Here's another:

Although, a 12,000 line JS file... honestly...

We should probably just disable highlighting in those cases.
(In reply to Jorge Villalobos [:jorgev] from comment #12)
> I almost never hit these warnings, but then again I don't review as much as
> Kris. Andrew, do you experience this problem often, or at all?

I used to get warnings on large files but it seems to be loading with only 2-3 second freeze now (on  There ideally shouldn't be any page/chrome freeze I suppose but its acceptable atm imo.
(In reply to Kris Maglione [:kmag] from comment #14)
> This still causes problems for me:
> ih.js#top

Same as Wil, it took a couple of seconds, but loaded just fine. This is on my main profile, with a couple of heavy extensions installed.

Comment 22

6 years ago
Well, on my i5 MacBook Pro they load pretty fast. But that's not saying much. On my day-to-day machine, which I know outpaces what most other editors use, it's still an issue.
Reclassifying editor bugs and changing to a new whiteboard flag. Spam, spam, spam, spam...
Whiteboard: [required amo-editors] → [ReviewTeam]


2 years ago
Product: → Graveyard
You need to log in before you can comment on or make changes to this bug.