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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

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%

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

Closes #5904.
@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%

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
1 participant