Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extremely slow font-locking on lines with lots of dot operators #196

Open
ryan-c-scott opened this issue Sep 9, 2021 · 1 comment
Open

Comments

@ryan-c-scott
Copy link

ryan-c-scott commented Sep 9, 2021

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")

@immerrr
Copy link
Owner

immerrr commented Sep 9, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants