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

Adds method and function deduplication to frontend. #5967

Merged
merged 7 commits into from
Jun 17, 2024

Conversation

esdrubal
Copy link
Contributor

@esdrubal esdrubal commented May 6, 2024

Description

Adds function cached to query engine, and reuses previously compiled methods and functions.

Closes #5904.

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 added 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. labels May 6, 2024
@esdrubal esdrubal self-assigned this May 6, 2024
@esdrubal esdrubal force-pushed the esdrubal/5904_method_dedup_in_frontend branch from 8e67524 to 1b48780 Compare May 6, 2024 15:55
Copy link

github-actions bot commented May 6, 2024

Benchmark for 137c576

Click to view benchmark
Test Base PR %
code_action 5.6±0.26ms 5.8±0.39ms +3.57%
code_lens 286.8±6.18ns 289.8±11.87ns +1.05%
compile 7.0±0.09s 6.9±0.12s -1.43%
completion 5.1±0.37ms 5.2±0.24ms +1.96%
did_change_with_caching 6.4±0.09s 6.4±0.10s 0.00%
document_symbol 1023.2±70.27µs 945.8±18.82µs -7.56%
format 90.3±1.29ms 87.9±1.34ms -2.66%
goto_definition 355.3±5.32µs 351.6±7.67µs -1.04%
highlight 8.8±0.57ms 9.2±0.27ms +4.55%
hover 583.0±12.41µs 589.1±9.90µs +1.05%
idents_at_position 120.4±0.95µs 119.8±0.78µs -0.50%
inlay_hints 639.0±15.71µs 652.7±26.13µs +2.14%
on_enter 494.4±68.41ns 491.8±11.83ns -0.53%
parent_decl_at_position 3.6±0.06ms 3.8±0.05ms +5.56%
prepare_rename 352.6±5.00µs 348.1±6.14µs -1.28%
rename 9.4±0.29ms 10.0±0.25ms +6.38%
semantic_tokens 1068.0±21.11µs 1042.2±19.31µs -2.42%
token_at_position 344.7±2.19µs 346.0±4.31µs +0.38%
tokens_at_position 3.6±0.06ms 3.7±0.02ms +2.78%
tokens_for_file 418.3±4.19µs 406.6±2.81µs -2.80%
traverse 52.6±1.56ms 51.7±1.73ms -1.71%

@esdrubal esdrubal force-pushed the esdrubal/5904_method_dedup_in_frontend branch from 1b48780 to c809b9a Compare May 20, 2024 13:40
Copy link

Benchmark for b7a8502

Click to view benchmark
Test Base PR %
code_action 5.4±0.10ms 5.5±0.08ms +1.85%
code_lens 281.7±6.90ns 340.0±10.65ns +20.70%
compile 3.0±0.02s 2.9±0.04s -3.33%
completion 4.7±0.11ms 4.7±0.03ms 0.00%
did_change_with_caching 2.8±0.03s 2.8±0.07s 0.00%
document_symbol 1083.5±32.37µs 963.9±7.59µs -11.04%
format 73.6±0.89ms 73.5±0.74ms -0.14%
goto_definition 365.0±7.72µs 368.5±5.75µs +0.96%
highlight 9.0±0.03ms 9.1±0.12ms +1.11%
hover 490.4±5.25µs 490.4±8.58µs 0.00%
idents_at_position 130.7±2.29µs 123.8±1.08µs -5.28%
inlay_hints 670.2±38.16µs 666.4±12.63µs -0.57%
on_enter 460.3±12.34ns 452.4±9.98ns -1.72%
parent_decl_at_position 3.7±0.04ms 3.8±0.03ms +2.70%
prepare_rename 366.7±10.89µs 367.5±14.04µs +0.22%
rename 9.6±0.18ms 9.7±0.12ms +1.04%
semantic_tokens 996.8±24.79µs 991.7±14.39µs -0.51%
token_at_position 364.8±2.36µs 365.9±3.54µs +0.30%
tokens_at_position 3.8±0.05ms 3.8±0.15ms 0.00%
tokens_for_file 426.1±1.74µs 421.5±2.22µs -1.08%
traverse 40.0±1.00ms 41.0±1.36ms +2.50%

Copy link

Benchmark for de6c896

Click to view benchmark
Test Base PR %
code_action 5.4±0.01ms 5.4±0.11ms 0.00%
code_lens 282.2±12.91ns 330.7±12.27ns +17.19%
compile 2.9±0.03s 2.8±0.03s -3.45%
completion 4.6±0.07ms 4.7±0.03ms +2.17%
did_change_with_caching 2.9±0.04s 2.7±0.03s -6.90%
document_symbol 1035.3±32.45µs 1038.1±48.09µs +0.27%
format 73.5±0.92ms 73.5±0.80ms 0.00%
goto_definition 367.2±6.85µs 367.0±3.89µs -0.05%
highlight 9.0±0.08ms 9.0±0.21ms 0.00%
hover 480.6±4.73µs 485.2±6.08µs +0.96%
idents_at_position 124.1±0.48µs 121.9±0.95µs -1.77%
inlay_hints 656.2±15.06µs 655.1±23.45µs -0.17%
on_enter 459.1±8.36ns 452.7±8.69ns -1.39%
parent_decl_at_position 3.7±0.02ms 3.7±0.03ms 0.00%
prepare_rename 361.1±4.05µs 367.2±9.19µs +1.69%
rename 9.6±0.11ms 9.6±0.03ms 0.00%
semantic_tokens 961.2±12.75µs 973.1±18.88µs +1.24%
token_at_position 363.6±3.69µs 360.7±4.33µs -0.80%
tokens_at_position 3.7±0.04ms 3.7±0.03ms 0.00%
tokens_for_file 418.1±2.54µs 412.8±5.08µs -1.27%
traverse 41.0±1.11ms 40.7±0.91ms -0.73%

@esdrubal esdrubal force-pushed the esdrubal/5904_method_dedup_in_frontend branch 2 times, most recently from ce9837c to de88bbd Compare June 13, 2024 09:41
Copy link

Benchmark for 85f8bf6

Click to view benchmark
Test Base PR %
code_action 5.1±0.04ms 5.1±0.16ms 0.00%
code_lens 344.4±8.50ns 284.4±8.39ns -17.42%
compile 3.4±0.05s 3.4±0.09s 0.00%
completion 4.7±0.04ms 4.7±0.13ms 0.00%
did_change_with_caching 3.2±0.05s 3.2±0.07s 0.00%
document_symbol 1015.3±49.61µs 962.7±50.83µs -5.18%
format 88.4±1.21ms 88.9±0.99ms +0.57%
goto_definition 348.6±6.58µs 351.9±7.17µs +0.95%
highlight 8.7±0.02ms 8.6±0.03ms -1.15%
hover 575.6±7.45µs 579.1±11.01µs +0.61%
idents_at_position 119.4±0.42µs 119.2±1.13µs -0.17%
inlay_hints 655.3±5.87µs 634.2±23.06µs -3.22%
on_enter 466.9±16.00ns 487.0±15.24ns +4.30%
parent_decl_at_position 3.6±0.01ms 3.6±0.03ms 0.00%
prepare_rename 351.1±4.58µs 352.7±7.41µs +0.46%
rename 8.9±0.02ms 8.9±0.04ms 0.00%
semantic_tokens 953.4±24.27µs 967.0±19.99µs +1.43%
token_at_position 349.6±2.55µs 347.2±3.23µs -0.69%
tokens_at_position 3.6±0.04ms 3.6±0.03ms 0.00%
tokens_for_file 412.4±1.64µs 402.8±1.52µs -2.33%
traverse 36.3±0.51ms 36.7±0.58ms +1.10%

Copy link

Benchmark for 95b70f0

Click to view benchmark
Test Base PR %
code_action 5.1±0.02ms 5.3±0.10ms +3.92%
code_lens 346.0±15.13ns 329.8±81.70ns -4.68%
compile 3.4±0.04s 3.3±0.06s -2.94%
completion 4.6±0.08ms 4.8±0.08ms +4.35%
did_change_with_caching 3.2±0.07s 3.2±0.08s 0.00%
document_symbol 931.4±19.31µs 1007.6±32.03µs +8.18%
format 87.9±1.09ms 89.4±1.47ms +1.71%
goto_definition 357.4±6.80µs 356.1±4.56µs -0.36%
highlight 8.7±0.17ms 9.1±0.03ms +4.60%
hover 572.8±5.54µs 582.4±4.91µs +1.68%
idents_at_position 119.7±0.25µs 120.2±1.01µs +0.42%
inlay_hints 658.3±35.37µs 652.9±23.05µs -0.82%
on_enter 478.2±8.60ns 488.1±25.71ns +2.07%
parent_decl_at_position 3.6±0.03ms 3.7±0.02ms +2.78%
prepare_rename 357.4±9.46µs 353.2±6.61µs -1.18%
rename 9.0±0.19ms 9.3±0.12ms +3.33%
semantic_tokens 971.6±26.71µs 965.0±26.51µs -0.68%
token_at_position 350.0±2.06µs 347.4±2.92µs -0.74%
tokens_at_position 3.6±0.02ms 3.7±0.02ms +2.78%
tokens_for_file 412.6±1.68µs 406.8±2.42µs -1.41%
traverse 36.0±0.40ms 35.4±0.94ms -1.67%

Copy link

Benchmark for 933ef5d

Click to view benchmark
Test Base PR %
code_action 5.2±0.02ms 5.3±0.25ms +1.92%
code_lens 342.1±15.40ns 290.0±26.41ns -15.23%
compile 3.5±0.06s 3.4±0.06s -2.86%
completion 4.8±0.13ms 4.8±0.05ms 0.00%
did_change_with_caching 3.2±0.11s 3.2±0.10s 0.00%
document_symbol 993.3±43.93µs 985.6±38.80µs -0.78%
format 87.8±1.59ms 89.1±1.19ms +1.48%
goto_definition 360.3±7.21µs 350.6±7.75µs -2.69%
highlight 9.1±0.25ms 9.0±0.10ms -1.10%
hover 597.4±20.72µs 571.6±8.78µs -4.32%
idents_at_position 120.9±0.34µs 119.5±1.34µs -1.16%
inlay_hints 661.1±27.51µs 652.8±17.65µs -1.26%
on_enter 460.5±22.98ns 490.5±15.42ns +6.51%
parent_decl_at_position 3.7±0.02ms 3.7±0.04ms 0.00%
prepare_rename 362.3±35.23µs 349.0±6.61µs -3.67%
rename 9.3±0.04ms 9.3±0.04ms 0.00%
semantic_tokens 951.8±27.18µs 964.5±14.84µs +1.33%
token_at_position 348.1±2.04µs 343.0±3.01µs -1.47%
tokens_at_position 3.7±0.03ms 3.7±0.02ms 0.00%
tokens_for_file 408.0±2.09µs 402.9±5.15µs -1.25%
traverse 36.8±1.17ms 37.0±1.08ms +0.54%

@esdrubal esdrubal marked this pull request as ready for review June 13, 2024 18:52
@esdrubal esdrubal requested a review from a team as a code owner June 13, 2024 18:52
xunilrj
xunilrj previously approved these changes Jun 14, 2024
IGI-111
IGI-111 previously approved these changes Jun 14, 2024
@esdrubal esdrubal dismissed stale reviews from IGI-111 and xunilrj via b6b0013 June 14, 2024 15:52
@esdrubal esdrubal force-pushed the esdrubal/5904_method_dedup_in_frontend branch from fb218f0 to b6b0013 Compare June 14, 2024 15:52
Copy link

Benchmark for 286d227

Click to view benchmark
Test Base PR %
code_action 5.2±0.02ms 5.2±0.02ms 0.00%
code_lens 346.5±31.82ns 289.6±8.34ns -16.42%
compile 3.5±0.10s 3.5±0.08s 0.00%
completion 4.8±0.10ms 4.7±0.02ms -2.08%
did_change_with_caching 3.3±0.08s 3.2±0.07s -3.03%
document_symbol 938.9±19.22µs 955.8±31.00µs +1.80%
format 89.1±0.93ms 89.5±4.28ms +0.45%
goto_definition 358.7±10.21µs 352.2±8.00µs -1.81%
highlight 9.0±0.21ms 9.0±0.21ms 0.00%
hover 582.3±9.15µs 571.7±4.97µs -1.82%
idents_at_position 121.1±0.94µs 121.7±0.63µs +0.50%
inlay_hints 693.5±19.94µs 655.7±24.66µs -5.45%
on_enter 467.4±14.40ns 501.3±14.69ns +7.25%
parent_decl_at_position 3.7±0.06ms 3.7±0.03ms 0.00%
prepare_rename 356.0±8.07µs 349.5±10.28µs -1.83%
rename 9.3±0.18ms 9.3±0.35ms 0.00%
semantic_tokens 975.3±20.02µs 973.9±12.67µs -0.14%
token_at_position 345.7±2.49µs 344.3±2.92µs -0.40%
tokens_at_position 3.7±0.03ms 3.7±0.04ms 0.00%
tokens_for_file 411.9±6.03µs 402.6±2.84µs -2.26%
traverse 36.9±0.72ms 37.1±0.52ms +0.54%

@JoshuaBatty JoshuaBatty requested a review from a team June 17, 2024 02:14
@IGI-111 IGI-111 merged commit b5fa25a into master Jun 17, 2024
38 checks passed
@IGI-111 IGI-111 deleted the esdrubal/5904_method_dedup_in_frontend branch June 17, 2024 05:47
@esdrubal esdrubal restored the esdrubal/5904_method_dedup_in_frontend branch June 17, 2024 12:39
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.

Improve frontend monomorphization to not generate identical methods when calling the same method
4 participants