-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add cache for binary search in lines-map #640
Comments
yes, i will try |
@5nord : i have started working on this issue and i have noted the things which i need TODO and here are things
am i correct in above steps? |
Sounds good to me. What you could do is executing the benchmarks before and after your change to see how big the improvement is. |
@5nord i have tried the above approach but it seems its not improving the performance. can you little guide me? |
No worries. It happens sometimes that an idea is not as good as we initially thought. That's why we measure first. And a negative result can still be a valuable result 🙂 Sure I can help you. I suggest you push your PR as a draft and we'll have a look. |
The method
syntax.Node.Span
uses binary search to convert a file offset into a line number.Location heavy tools, like our language server or formatter, would benefit from line-caches. For example like so:
To be efficient we probably need two separate line-caches, one for
n.Pos()
and one forn.End()
.Best would be creating benchmarks comparing random position access, accessing only begin-offsets and accessing whole spans (begin- and end-offset).The text was updated successfully, but these errors were encountered: