-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
It takes 15 seconds for completions to appear in large files after errors #1128
Comments
Instinct says this might be code actions being gathered? Any ideas @Techatrix? :) |
When I disable the error lens VSCode extension, it seems to be better - but it would be best not to disable that as it is very helpful edit: nevermind, error lens is unrelated |
Most of the time is spend constructing the document scope whenever a file changes. I previously investigated what caused document scope generation to be slow and I found out that it spends most of its time allocating in the GPA. Here is tracy while editing I explored a few options that could optimize this. The most effective and simple one is replacing the GPA with malloc. If you edit a file and keep it syntactically correct so that ast_check is going to be run often, setting If we want to optimize this even further, we probably need to do re-parsing or utilize multi-threading with some smart trickery. |
I assume the "keep it syntactically correct" part is due to challenges with error handling? I lack context, but could this be run in the same process in one (in total) separate thread? Could try something like in the panic handler, reset a bump allocator to 0 and then do a long jmp back to the thread's init function |
I think I kind of misdirected you with my last line about The With "keep it syntactically correct" is meant that |
On macOS, it looks like spawning the process is about 30% of the overhead. A persistent process which uses a bump allocator to reset the memory back to the beginning should make every call after the first run faster because in theory, it wouldn't be allocating additional memory from the operating system. If each of these takes 25ms or so and it's queuing calls to |
The issue definitely gets worse the more times a file is saved until zls' next restart/crash |
Using |
…llocator page_allocator + GeneralPurposeAllocator is a performance footgun zigtools/zls#1128
Re-opened, as #1134 has not been merged, so this is still happening unless compiling ZLS separately in a fork |
#1134 has been merged. |
Zig Version
0.11.0-dev.2401+348751462
Zig Language Server Version
HEAD
Steps to Reproduce
Make a change in this file https://github.com/oven-sh/bun/blob/0cc56e8efce9c7d4905b3649827bf9b40a677b25/src/js_parser.zig#L5901
Expected Behavior
It should be instant
Actual Behavior
It seems to process a queue of errors and each error to process takes considerable time, so the more times you save the slower it gets.
Here is a 15 second gif (note that it was not slowed down)
The text was updated successfully, but these errors were encountered: