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:
- 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.
- 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.