Page MenuHomePhabricator

Syntax Highlighter consumes insane amounts of CPU on large texts or on mobile phone.
Open, LowPublic


The Syntax Highlighter is an amazing gadget, but one thing that I have constantly suffered from is the script running on large pages or my mobile phone.

The current version of the syntax highlighter runs through the text area on every keystroke. This is highly problematic on larger pages or phone editing as the typing gets slowed down. The result is that a user types something and has to wait until the sentence gets typed out as the highlighter steps in on every character being inserted. During that process I've seen the browser process consume quite a generous amount of CPU resources on my computer, and on my phone the CPU gets maxed out.

I propose one of the following two solutions:

  1. Have the highlighter wait until 1.5 seconds after the last key stroke to process the page. That means the highlighter remains idle until the user has finished typing thus the highlighter will not block the text field as a user types. It's pointless to process highlighting while the user types.
  2. Have the highlighter come with options to disable highlighting when the page size goes beyond a certain threshold or initial processing time takes too long. The run time threshold option should be in milli or micro seconds.

This will go a long way to making the highlighter not kill performance on a mobile phone.


Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 15 2018, 10:53 PM
Restricted Application added a project: Community-Tech. · View Herald TranscriptJun 15 2018, 11:30 PM

Syntax highlighting is not meant to be used on mobile yet. It might be integrated with mobile frontend editor at some point but if you are using the desktop site on mobile, you will run into this problem.

Niharika triaged this task as Low priority.Jun 18 2018, 10:47 PM
Niharika removed a project: Community-Tech.
JMinor added a subscriber: JMinor.Jun 18 2018, 11:19 PM
Niedzielski moved this task from Needs triage to Triaged on the Mobile board.Jun 20 2018, 1:47 PM
Vvjjkkii renamed this task from Syntax Highlighter consumes insane amounts of CPU on large texts or on mobile phone. to 5saaaaaaaa.Jul 1 2018, 1:03 AM
Vvjjkkii removed MusikAnimal as the assignee of this task.
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: MusikAnimal; removed: Aklapper.
Cyberpower678 renamed this task from 5saaaaaaaa to Syntax Highlighter consumes insane amounts of CPU on large texts or on mobile phone..Jul 1 2018, 2:08 PM
Cyberpower678 assigned this task to MusikAnimal.
Cyberpower678 lowered the priority of this task from High to Low.
Cyberpower678 updated the task description. (Show Details)
Cyberpower678 added a project: Mobile.
Cyberpower678 edited subscribers, added: Aklapper; removed: MusikAnimal.

Change 574855 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/CodeMirror@master] Improve render performance of CodeMirror