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

Cache in front of check_if_trait_constraints_are_satisfied_for_type #5827

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Apr 4, 2024

Description

Partially fixes #5781.

This reduces the problem of millions of TypeInfos being created.
For more details see: #5782

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

Copy link

github-actions bot commented Apr 4, 2024

Benchmark for bf62677

Click to view benchmark
Test Base PR %
code_action 5.5±0.11ms 5.2±0.06ms -5.45%
code_lens 283.7±3.82ns 288.8±16.71ns +1.80%
compile 6.0±0.17s 5.9±0.07s -1.67%
completion 4.9±0.06ms 4.7±0.16ms -4.08%
did_change_with_caching 5.4±0.02s 5.4±0.04s 0.00%
document_symbol 998.4±44.74µs 945.9±26.07µs -5.26%
format 71.1±1.22ms 71.1±1.97ms 0.00%
goto_definition 355.9±10.40µs 362.5±15.46µs +1.85%
highlight 9.1±0.15ms 8.7±0.22ms -4.40%
hover 626.2±21.66µs 606.6±25.93µs -3.13%
idents_at_position 123.2±0.41µs 122.6±1.51µs -0.49%
inlay_hints 654.5±19.37µs 676.0±27.86µs +3.28%
on_enter 494.2±16.81ns 484.4±8.73ns -1.98%
parent_decl_at_position 3.8±0.02ms 3.6±0.09ms -5.26%
prepare_rename 353.8±7.34µs 365.9±5.01µs +3.42%
rename 9.6±0.12ms 9.1±0.10ms -5.21%
semantic_tokens 1013.9±12.68µs 1051.6±15.55µs +3.72%
token_at_position 353.6±1.09µs 362.8±5.23µs +2.60%
tokens_at_position 3.8±0.02ms 3.5±0.06ms -7.89%
tokens_for_file 412.0±1.58µs 415.6±4.43µs +0.87%
traverse 43.5±1.37ms 44.5±1.63ms +2.30%

@xunilrj xunilrj requested a review from a team April 4, 2024 14:45
@xunilrj xunilrj self-assigned this Apr 4, 2024
@JoshuaBatty JoshuaBatty requested a review from a team April 4, 2024 22:20
Copy link

github-actions bot commented Apr 5, 2024

Benchmark for 54b1fcf

Click to view benchmark
Test Base PR %
code_action 5.5±0.08ms 5.4±0.17ms -1.82%
code_lens 291.0±9.58ns 343.6±12.82ns +18.08%
compile 6.0±0.04s 6.1±0.19s +1.67%
completion 5.0±0.17ms 5.0±0.09ms 0.00%
did_change_with_caching 5.5±0.06s 5.4±0.06s -1.82%
document_symbol 947.9±27.90µs 1002.3±37.70µs +5.74%
format 90.9±1.49ms 89.9±1.66ms -1.10%
goto_definition 364.0±8.31µs 365.0±5.81µs +0.27%
highlight 9.2±0.15ms 9.1±0.19ms -1.09%
hover 601.0±21.35µs 610.3±16.64µs +1.55%
idents_at_position 125.2±0.72µs 121.6±0.58µs -2.88%
inlay_hints 665.1±34.60µs 663.7±14.87µs -0.21%
on_enter 484.2±8.59ns 489.2±4.61ns +1.03%
parent_decl_at_position 3.9±0.15ms 3.7±0.06ms -5.13%
prepare_rename 355.2±6.37µs 358.2±5.72µs +0.84%
rename 9.6±0.17ms 9.6±0.22ms 0.00%
semantic_tokens 1053.0±18.70µs 1058.5±13.75µs +0.52%
token_at_position 353.3±2.67µs 362.1±2.51µs +2.49%
tokens_at_position 3.8±0.03ms 3.7±0.03ms -2.63%
tokens_for_file 414.9±3.87µs 415.2±6.24µs +0.07%
traverse 43.9±1.32ms 45.1±2.13ms +2.73%

Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just wondering how big this cache gets over time, and if its worth cleaning it up when doing garbage collection for the LSP, over time after it passes a certain size threshold.

@xunilrj xunilrj merged commit 187146b into master Apr 5, 2024
36 checks passed
@xunilrj xunilrj deleted the xunilrj/cache-for-check-constraint branch April 5, 2024 09:52
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

Successfully merging this pull request may close these issues.

Performance problem with --experimental-new-encoding and MegaExample
3 participants