Is it really the regex causing the lag? I haven't jumped into the code yet, but I would expect (or at least hope) the highlighter runs once and the lag is due to whatever DOM/styles it's generating.
Re:Microlight.js, a code highlighting library
by lucideer on Monday May 30, 2016 @04:34PM
(#11803027)
Site works with no lag on my low end android. Someone else commented on issues on iPhone6 so possibly a Safari-specific bottleneck being hit.
Hello, Firefox on Android user here on a tablet from circa 2012. Extreme lag, unlike most websites.
There are definitely unacceptable performance issues with the syntax highlighter javascript.
It looks great, it's a cool project, but it is not suitable for use anywhere.
Looks like the `overflow:auto` on the page container div, not actually anything to do with the library.
Re:Microlight.js, a code highlighting library
by jaytaylor on Monday May 30, 2016 @06:09PM
(#11803501)
Disclaimer: This is not my library, this is what I've gleaned from reading the code. I could always be wrong!
It actually can use RegExp's, but they're only being used to locate the language primitive types words (e.g. char, wchar_t, etc..).
Most of the library is actually written as a hand-implemented state machine rather than relying on regular expressions.
Almost un readable on a fairly quick phone...