Slow Script warning on bugzilla page when loading preview of large json file

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: rowbot, Assigned: kohei)

Tracking

Production

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

It would appear that bugzilla's file preview feature is having a bad time with a large json file in Bug 1263593. Not sure where to file this bug.

Performance profile: https://perfht.ml/2ZwmY5I

STR:

  1. Go to Bug 1263593 comment 4

Better performance profile: http://bit.ly/2UMzV87

Component: General → Graphics

86% of the time in the profile is in js. -> js for a look.

Component: Graphics → JavaScript Engine

Of that 86% of the time, 78% is spent in js::irregexp::InterpretCode, handling a regexp in the matchGrammar function in this Prism.js code (which does syntax highlighting).

On my machine, at least, Chrome also crashes. The problem is either a degenerate regex, or an overly large json file.

It looks like prism.js supports async highlighting, which might let us move the highlighting offthread and avoid blocking the main thread. Alternatively, maybe Bugzilla should just skip syntax highlighting on files above a certain size.

Dylan, can this get fixed in Bugzilla's file preview code?

Flags: needinfo?(dylan)

The json file being processes is 1.10MB according to Bugzilla.

I believe there is a patch in flight to turn off preview on larger files, so this should be fixed in that way soon. We might also do the async highlighting at a later date.

Flags: needinfo?(dylan)

Based on the Gecko profile link from comment 1, this looks like a BugModal extension & prism.js issue.
Moving to bugzilla.mozilla.org component.

Component: JavaScript Engine → General
Product: Core → bugzilla.mozilla.org
Version: Trunk → Production
Assignee: nobody → kohei.yoshino
Component: General → User Interface: Modal

Seems like Prism’s async highlighting is not working, so I’ll just limit the max text preview size to 50 KB.

Status: NEW → ASSIGNED

Merged to master.

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Duplicate of this bug: 1552230
You need to log in before you can comment on or make changes to this bug.