Alright, just tried with the profiler and the big part of the problem should be solved by the patch here:
https://github.com/techee/geany/commit/a11f82b7bca2697b41cbf01cf3151aad608f4...
It doesn't fix the slowness completely but at least it should fix the non-linear part of it. With about 4000 lines from your example about 75% of time was spent by rehighlighting the document. The remaining 25% were spent by the parser (I'm afraid we cannot do much with this).
If you are able to recompile, could you try the patch if it helps?
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/791#issuecomment-163970875