Closed Bug 929225 Opened 11 years ago Closed 9 years ago

Don't fallback to text syntax highlighting mode for large files

Categories

(DevTools :: Debugger, defect, P3)

x86
macOS
defect

Tracking

(firefox46 verified)

VERIFIED FIXED
Firefox 46
Tracking Status
firefox46 --- verified

People

(Reporter: anton, Assigned: jlong)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In the debugger-view.js we have the following code: if (aTextContent.length >= SOURCE_SYNTAX_HIGHLIGHTING_MAX_FILE_SIZE) return void this.editor.setMode(Editor.mode.text); I'm not sure this is still necessary with bug 919709.
I removed it and loading the asm.js code for http://www.unrealengine.com/html5/ is instant now! But that's on my mac. We need to test this on old hardware too.
Note that very long lines are still an issue in CM (https://github.com/marijnh/CodeMirror/issues/1022)
Maybe increase the value of SOURCE_SYNTAX_HIGHLIGHTING_MAX_FILE_SIZE?
I think we should go with a better heuristics to determine the threshold instead of just file size . Even if CM can now load even bigger files faster, it is slow on minified single lined files which are very long. Maybe have a heuristics depending on the max (or median) line size.
Summary: Check whether it is still necessary to use editor's text mode for large files → Check if we still need to switch the editor to text mode for large files
Assignee: nobody → jlong
Attached patch 929225.patchSplinter Review
This is very doable now. I tested a 50MB JS file with a line that that 40K chars on it and it was fine. I think we should enable and see if anyone finds problems with it in the wild.
See Also: → 1232292
Comment on attachment 8697736 [details] [diff] [review] 929225.patch Review of attachment 8697736 [details] [diff] [review]: ----------------------------------------------------------------- Brian, I tested this on a huge file and CodeMirror has definitely optimized for this. It probably only highlights the code in the viewport, and doesn't need to parse the code, just uses regexs to match keywords.
Attachment #8697736 - Flags: review?(bgrinstead)
Comment on attachment 8697736 [details] [diff] [review] 929225.patch Review of attachment 8697736 [details] [diff] [review]: ----------------------------------------------------------------- I'm worried about adding anything that might slow down opening large files since it can still be really janky with huge files, especially on lower memory devices. However I've profiled this and and most of time spent janking on load has nothing to do with highlighting. In my measurements with a 50MB file setting the mode to js took around 73ms while setting it to text took around 55ms. In both cases setting the text in the editor took around 8 seconds total so this is a drop in the bucket. Also, the highlighting runs after the load is done and once the framerate is back up to normal. ::: devtools/client/debugger/debugger-view.js @@ -409,5 @@ > */ > _setEditorMode: function(aUrl, aContentType = "", aTextContent = "") { > - // Avoid setting the editor mode for very large files. > - // Is this still necessary? See bug 929225. > - if (aTextContent.length >= SOURCE_SYNTAX_HIGHLIGHT_MAX_FILE_SIZE) { Please also remove the const at the top of the file
Attachment #8697736 - Flags: review?(bgrinstead) → review+
Summary: Check if we still need to switch the editor to text mode for large files → Don't fallback to text syntax highlighting mode for large files
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 46
[bugday-20160323] STR: Please mention "steps to reproduce" clearly for verification during testdays. Status: RESOLVED -> UNVERIFIED Component: Name Firefox Version 46.0b2 Build ID 20160314144540 Update Channel beta User Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 OS Windows 7 SP1 x86_64 Actual Results: Ambiguous steps to reproduce problem. So from whatever data is there: 1. On https://bugzilla.mozilla.org/show_bug.cgi?id=929225 2. Open Debugger, there is no file in sources window named as view.js 3. Test fails. Expected Results: Please give STR for testing.
Flags: needinfo?(jlong)
Please file a new bug.
Flags: needinfo?(jlong)
Product: Firefox → DevTools
Blocks: 1565711
Blocks: 1565713
No longer blocks: 1565711
No longer blocks: 1565713
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: