Extremely slow font-locking on lines with lots of dot operators
GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32)
eg.
local DeadEnvironment = _G._Systems.ReplicatedStorage.src.Core.Input.ClientProcessors.DeadEnvironment
Experimenting with solutions and found that replacing:
(lua-name (symbol (seq (+ (any alpha "_")) (* (any alnum "_")))))
(lua-funcname (seq lua-name (* ws "." ws lua-name) (opt ws ":" ws lua-name)))
with
(lua-name (symbol (seq (+ (any alpha "_" ".")) (* (any alnum "_")))))
(lua-funcname (seq lua-name (* lua-name) (opt ws ":" ws lua-name)))
Resolved the performance issue, but I'm still testing on my use case to see if that affects other font-locking.
Specifically it seems to be the repeated match against 'lua-name' in 'lua-funcname'
0001-Modified-the-way-that-function-names-are-matched-in-.patch.txt
(As an aside, shocked that GH won't accept a text file with the extension ".patch")
Hi,
I'm having trouble reproducing it on
GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2021-04-10
(could be linux vs windows, but needs further investigation)
I just tried a 1M file full of the lines above, and both reopening the file and running (jit-lock-refontify) were fast.
Your change works, but at the cost of no longer being able to (foo).(bar) parts of the lua-funcname as separate parts and capture foo. bar as a lua-funcname. None of it is a big deal, but I'd like to ensure this is the only way to fix this.
Would you be able to provide a full repro?
And for shortening the verification loop, could you confirm that (jit-lock-refontify) is slow for you on the affected buffers?
Thanks!