Skip to content

Optimise readLine by iterating over m_text in a tighter loop

Wrap the latter half of the while in its own for to give the compiler a better shot at properly optimising it.

Obviously behaviour will vary with compiler / optimisation flags, etc. but for me (built with gcc 13.2, RelWithDebInfo) this consistently gives between 1.2x and 2x faster loading for files with long lines (e.g. minified files, PDFs, etc), depending on the file.

On files with shorter lines, other code dominates, and this makes no measurable difference.

Thanks.

Merge request reports