-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
lazily compute resources of DocumentStore handles #1492
Conversation
cb0d035
to
8b0c3c1
Compare
4a91b5e
to
0519e3a
Compare
10309a3
to
786ed3a
Compare
Instead creating the DocumentStore (and ZIR if needed) whenever the document gets modified, it is more efficient to compute them lazily. This will mean that series of text edits without any requests on them which often occur while typing will be processed quicker. I've also tested lazily computing the Ast but it turned out that the Ast was (almost) always needed which made this unnecessary.
786ed3a
to
f9a438d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been meaning to ask, are these intentionally not pointers (completions.zig, ~line 844)?
fn completeFileSystemStringLiteral(
arena: std.mem.Allocator,
store: DocumentStore,
handle: DocumentStore.Handle,
Ideally speaking, I would argue that pass by value should be preferred over pass by reference/pointer in zig since it gives the compiler more opportunities to optimize the code. Unfortunately in its current state, zig is sometimes failing to generate the most optimal code (#17580) but hopefully this won't be the case in the future. This has been the main motivation why I did this. Another example of this issue would be the |
Nah, just me and my C mindset wondering if there was a specific technical subtlety there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be gud .
Instead creating the DocumentStore (and ZIR if needed) whenever the document gets modified, it is more efficient
to compute them lazily needed. This will mean that series of text edits without any requests on them which often occur while typing will be processed quicker with less latency.
I've also tested lazily computing the Ast but it turned out that the Ast was (almost) always needed which made this unnecessary.