The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in 4.x (triaged)

Status

addons.mozilla.org Graveyard
Admin/Editor Tools
P3
normal
RESOLVED FIXED
6 years ago
a year ago

People

(Reporter: kmag, Unassigned)

Tracking

unspecified
4.x (triaged)

Details

(Whiteboard: [ReviewTeam])

(Reporter)

Description

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: https://addons.mozilla.org/en-US/firefox/files/browse/119634/#top

Reproducible: Always
Looks like we're using http://code.google.com/p/google-diff-match-patch/ (which is an enormous JS file).

I'm happy to hear alternatives or improvements.
(Reporter)

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.
(Reporter)

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).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Whiteboard: [required amo-editors]
Target Milestone: --- → Q2 2011
The syntax highlighter we're using is http://alexgorbatchev.com/SyntaxHighlighter/

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

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 addons.allizom.org
(Reporter)

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
https://addons.allizom.org/en-US/firefox/files/browse/119634/file/chrome/content/lyz/lyz.js#top

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
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Reporter)

Comment 10

5 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?
(Reporter)

Comment 13

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

Comment 14

5 years ago
This still causes problems for me:

https://addons.mozilla.org/files/compare/139531...132249/file/chrome/content/ih.js#top
Page took a couple seconds to load, but no warnings for me.
(Reporter)

Comment 16

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

Comment 17

5 years ago
For me it spun my CPU for 20 seconds before I got the unresponsive script warning.
(Reporter)

Comment 18

5 years ago
I should also note, to put this into perspective, that I was at the MozCamp.de editors meeting and mine was one of the more powerful computers there.
(Reporter)

Comment 19

5 years ago
Here's another: https://addons.mozilla.org/files/browse/138903/file/content/facebookhidenames.js#top

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 https://addons.mozilla.org/files/browse/138903/file/content/facebookhidenames.js).  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:
> 
> https://addons.mozilla.org/files/compare/139531...132249/file/chrome/content/
> 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.
(Reporter)

Comment 22

5 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]
(Assignee)

Updated

a year ago
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.