Skip to content
New issue

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

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

Already on GitHub? # to your account

Cache Build Plans in language server #6281

Merged
merged 7 commits into from
Jul 22, 2024
Merged

Cache Build Plans in language server #6281

merged 7 commits into from
Jul 22, 2024

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Jul 19, 2024

Description

closes #5462
related #5445

before we were recreating the build plan on every keystroke. We now cache the result and reuse on subsequent did change events. We invalidate the cache if there has been any modifications to the Forc.toml file since the cache was created.

Here are the timings when triggering this with a did_change event on the FUSD repo.

previous: 80.146ms
with this change: 56µs

@JoshuaBatty JoshuaBatty requested a review from a team as a code owner July 19, 2024 04:07
@JoshuaBatty JoshuaBatty marked this pull request as draft July 19, 2024 04:07
@JoshuaBatty JoshuaBatty self-assigned this Jul 19, 2024
@JoshuaBatty JoshuaBatty added language server LSP server performance Everything related to performance, speed wise or memory wise. labels Jul 19, 2024
@JoshuaBatty JoshuaBatty force-pushed the josh/cache_build_plan branch from 2e06b31 to c3ac08e Compare July 19, 2024 05:48
@JoshuaBatty JoshuaBatty marked this pull request as ready for review July 19, 2024 05:55
@JoshuaBatty JoshuaBatty requested a review from a team July 19, 2024 05:55
@JoshuaBatty JoshuaBatty marked this pull request as draft July 19, 2024 06:12
Copy link

Benchmark for f0ef31b

Click to view benchmark
Test Base PR %
code_action 5.0±0.09ms 5.2±0.02ms +4.00%
code_lens 298.5±9.61ns 338.4±23.38ns +13.37%
compile 2.7±0.05s 2.7±0.04s 0.00%
completion 4.5±0.09ms 4.7±0.07ms +4.44%
did_change_with_caching 2.6±0.10s 2.7±0.04s +3.85%
document_symbol 944.7±59.75µs 915.1±25.24µs -3.13%
format 68.5±0.97ms 69.7±1.37ms +1.75%
goto_definition 342.1±5.56µs 350.9±7.13µs +2.57%
highlight 8.7±0.13ms 9.0±0.01ms +3.45%
hover 491.6±5.89µs 500.8±8.32µs +1.87%
idents_at_position 123.7±1.96µs 119.8±0.95µs -3.15%
inlay_hints 627.9±27.20µs 654.5±18.04µs +4.24%
on_enter 522.5±10.98ns 512.9±30.71ns -1.84%
parent_decl_at_position 3.7±0.03ms 3.7±0.03ms 0.00%
prepare_rename 349.9±5.51µs 347.5±7.83µs -0.69%
rename 8.9±0.21ms 9.4±0.37ms +5.62%
semantic_tokens 1285.0±16.36µs 1247.7±21.25µs -2.90%
token_at_position 343.3±3.16µs 333.4±3.95µs -2.88%
tokens_at_position 3.6±0.03ms 3.7±0.03ms +2.78%
tokens_for_file 404.3±4.27µs 466.5±5.98µs +15.38%
traverse 38.9±1.81ms 43.2±1.02ms +11.05%

@JoshuaBatty JoshuaBatty force-pushed the josh/cache_build_plan branch from 1647a6e to e36eca0 Compare July 21, 2024 23:48
Copy link

Benchmark for b615a06

Click to view benchmark
Test Base PR %
code_action 5.2±0.10ms 5.2±0.10ms 0.00%
code_lens 287.0±11.07ns 289.7±10.38ns +0.94%
compile 2.6±0.04s 2.6±0.05s 0.00%
completion 4.7±0.01ms 4.6±0.06ms -2.13%
did_change_with_caching 2.6±0.02s 2.6±0.02s 0.00%
document_symbol 884.8±36.23µs 875.5±16.97µs -1.05%
format 67.9±1.20ms 68.5±1.01ms +0.88%
goto_definition 344.0±7.20µs 344.7±8.06µs +0.20%
highlight 9.1±0.01ms 9.0±0.01ms -1.10%
hover 502.9±10.19µs 497.5±11.34µs -1.07%
idents_at_position 119.3±0.66µs 120.2±1.06µs +0.75%
inlay_hints 639.1±20.69µs 639.0±26.12µs -0.02%
on_enter 477.3±6.26ns 463.1±8.53ns -2.98%
parent_decl_at_position 3.7±0.02ms 3.7±0.01ms 0.00%
prepare_rename 342.6±6.84µs 342.2±4.78µs -0.12%
rename 9.3±0.09ms 9.3±0.10ms 0.00%
semantic_tokens 1271.1±15.60µs 1284.6±12.45µs +1.06%
token_at_position 338.1±1.52µs 332.2±2.18µs -1.75%
tokens_at_position 3.7±0.03ms 3.7±0.02ms 0.00%
tokens_for_file 403.6±2.23µs 400.2±3.30µs -0.84%
traverse 36.7±0.92ms 37.1±0.80ms +1.09%

@JoshuaBatty JoshuaBatty marked this pull request as ready for review July 22, 2024 00:20
@kayagokalp kayagokalp requested a review from a team July 22, 2024 10:22
@IGI-111 IGI-111 merged commit 0b440ea into master Jul 22, 2024
39 checks passed
@IGI-111 IGI-111 deleted the josh/cache_build_plan branch July 22, 2024 10:23
esdrubal pushed a commit that referenced this pull request Aug 13, 2024
## Description
closes #5462
related #5445

before we were recreating the build plan on every keystroke. We now
cache the result and reuse on subsequent did change events. We
invalidate the cache if there has been any modifications to the
`Forc.toml` file since the cache was created.

Here are the timings when triggering this with a did_change event on the
FUSD repo.

previous: `80.146ms`
with this change: `56µs`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
language server LSP server performance Everything related to performance, speed wise or memory wise.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache BuildPlan in LSP
3 participants