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

Reduces memory footprint of collecting unifications. #6479

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

esdrubal
Copy link
Contributor

@esdrubal esdrubal commented Aug 28, 2024

Description

As shown in https://fuellabs.github.io/sway-performance-dashboard/ #6461 introduced a bigger memory footprint.

Lexical scope has a shared OrdMap called symbols_unique_while_collecting_unifications that was never cleared.
With this commit, it is cleared on each code block along with the clear of collected unifications.

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.

@esdrubal esdrubal marked this pull request as ready for review August 28, 2024 19:38
@esdrubal esdrubal requested a review from a team as a code owner August 28, 2024 19:38
@esdrubal esdrubal self-assigned this Aug 28, 2024
@esdrubal esdrubal added performance Everything related to performance, speed wise or memory wise. compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Aug 28, 2024
Copy link

Benchmark for 0908ac4

Click to view benchmark
Test Base PR %
code_action 5.1±0.09ms 5.1±0.09ms 0.00%
code_lens 290.7±10.98ns 297.2±10.38ns +2.24%
compile 1924.9±59.74ms 1909.1±52.37ms -0.82%
completion 4.5±0.07ms 4.5±0.06ms 0.00%
did_change_with_caching 1852.7±17.29ms 1819.5±8.33ms -1.79%
document_symbol 856.5±25.49µs 849.4±27.13µs -0.83%
format 73.1±1.09ms 73.1±0.76ms 0.00%
goto_definition 335.9±6.79µs 338.8±9.48µs +0.86%
highlight 8.9±0.01ms 9.0±0.08ms +1.12%
hover 346.1±7.62µs 351.8±8.42µs +1.65%
idents_at_position 118.8±0.68µs 118.7±0.44µs -0.08%
inlay_hints 640.7±23.76µs 642.3±17.82µs +0.25%
on_enter 2.1±0.14µs 1963.3±91.91ns -6.51%
parent_decl_at_position 3.7±0.04ms 3.7±0.01ms 0.00%
prepare_rename 336.3±4.70µs 340.0±7.89µs +1.10%
rename 9.3±0.01ms 9.2±0.05ms -1.08%
semantic_tokens 1157.0±14.28µs 1262.7±11.02µs +9.14%
token_at_position 334.6±2.29µs 342.7±8.14µs +2.42%
tokens_at_position 3.7±0.02ms 3.7±0.06ms 0.00%
tokens_for_file 400.0±2.66µs 397.6±7.86µs -0.60%
traverse 34.2±0.57ms 33.6±0.63ms -1.75%

Copy link

Benchmark for 4a622d4

Click to view benchmark
Test Base PR %
code_action 5.1±0.09ms 5.1±0.15ms 0.00%
code_lens 288.6±8.93ns 286.1±10.31ns -0.87%
compile 2.2±0.07s 1919.8±73.81ms -12.74%
completion 4.5±0.06ms 4.5±0.09ms 0.00%
did_change_with_caching 2.0±0.07s 1838.8±32.40ms -8.06%
document_symbol 887.2±37.29µs 911.1±39.50µs +2.69%
format 74.5±0.90ms 72.8±1.23ms -2.28%
goto_definition 334.8±5.97µs 339.2±5.25µs +1.31%
highlight 9.0±0.08ms 9.0±0.22ms 0.00%
hover 347.5±6.22µs 349.8±5.85µs +0.66%
idents_at_position 116.4±0.41µs 119.1±0.50µs +2.32%
inlay_hints 640.1±34.34µs 637.4±14.35µs -0.42%
on_enter 2.1±0.06µs 1956.8±86.34ns -6.82%
parent_decl_at_position 3.7±0.04ms 3.7±0.06ms 0.00%
prepare_rename 337.0±8.53µs 338.5±6.21µs +0.45%
rename 9.4±0.19ms 9.3±0.26ms -1.06%
semantic_tokens 1189.4±15.65µs 1227.6±18.78µs +3.21%
token_at_position 332.0±2.72µs 337.5±2.32µs +1.66%
tokens_at_position 3.7±0.03ms 3.7±0.09ms 0.00%
tokens_for_file 400.5±4.07µs 395.9±3.02µs -1.15%
traverse 36.4±0.79ms 33.5±0.62ms -7.97%

@JoshuaBatty JoshuaBatty enabled auto-merge (squash) August 28, 2024 23:24
@JoshuaBatty JoshuaBatty merged commit 40efa46 into master Aug 28, 2024
36 checks passed
@JoshuaBatty JoshuaBatty deleted the esdrubal/perf_memory branch August 28, 2024 23:39
Copy link

Benchmark for 714cb24

Click to view benchmark
Test Base PR %
code_action 5.2±0.01ms 5.0±0.10ms -3.85%
code_lens 283.3±5.60ns 286.0±8.01ns +0.95%
compile 1936.4±69.55ms 1824.8±54.29ms -5.76%
completion 4.5±0.03ms 4.4±0.08ms -2.22%
did_change_with_caching 1815.8±19.84ms 1768.7±12.07ms -2.59%
document_symbol 865.5±22.99µs 896.8±36.08µs +3.62%
format 81.7±1.94ms 82.5±1.21ms +0.98%
goto_definition 336.4±6.22µs 348.4±5.41µs +3.57%
highlight 9.1±0.03ms 8.7±0.04ms -4.40%
hover 346.1±10.39µs 359.5±5.50µs +3.87%
idents_at_position 117.2±0.30µs 119.0±1.12µs +1.54%
inlay_hints 643.6±11.86µs 650.8±9.08µs +1.12%
on_enter 1895.2±41.40ns 1984.3±77.39ns +4.70%
parent_decl_at_position 3.7±0.04ms 3.6±0.04ms -2.70%
prepare_rename 332.4±6.58µs 348.0±7.62µs +4.69%
rename 9.4±0.11ms 9.0±0.49ms -4.26%
semantic_tokens 1248.9±10.35µs 1195.2±7.90µs -4.30%
token_at_position 333.0±2.85µs 353.3±1.53µs +6.10%
tokens_at_position 3.7±0.05ms 3.6±0.03ms -2.70%
tokens_for_file 401.6±2.32µs 398.0±4.14µs -0.90%
traverse 32.6±0.90ms 33.2±0.49ms +1.84%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen performance Everything related to performance, speed wise or memory wise.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants