Hacker News new | ask | show | jobs
by hougaard 3674 days ago
And it made the site super sluggish. Guess that huge regex needs a dedicated cpu.

Almost un readable on a fairly quick phone...

3 comments

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