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

fix dca for encoding v1 autogenerated code #6006

Merged
merged 4 commits into from
May 20, 2024
Merged

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented May 14, 2024

Description

This PR is part of #5727 and fixes a problem with AbiEncode/AbiDecode code generation. The problem lies in the fact that to encode/decode structs we need to "touch" all fields. Which makes all fields to pass DCA.

Now, when a StructFieldAccess lives inside an autogenerated source, the "code flow graph" will be built as usual, but no edge will be created to the struct field, nor to the field owner struct declaration.

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.

@xunilrj xunilrj changed the title fix dca for autogenerated code fix dca for encoding v1 autogenerated code May 14, 2024
Copy link

Benchmark for 1073bd5

Click to view benchmark
Test Base PR %
code_action 5.5±0.10ms 5.7±0.18ms +3.64%
code_lens 327.5±9.35ns 329.9±16.64ns +0.73%
compile 3.1±0.05s 3.1±0.05s 0.00%
completion 4.7±0.09ms 4.9±0.16ms +4.26%
did_change_with_caching 3.0±0.03s 3.0±0.03s 0.00%
document_symbol 1006.8±43.41µs 943.9±23.99µs -6.25%
format 89.7±1.27ms 88.2±0.51ms -1.67%
goto_definition 358.3±4.65µs 367.6±8.97µs +2.60%
highlight 9.1±0.12ms 9.3±0.24ms +2.20%
hover 478.0±5.99µs 487.8±8.47µs +2.05%
idents_at_position 122.4±0.52µs 124.4±1.33µs +1.63%
inlay_hints 657.8±22.00µs 665.0±14.93µs +1.09%
on_enter 490.7±22.29ns 494.2±13.03ns +0.71%
parent_decl_at_position 3.7±0.05ms 3.8±0.08ms +2.70%
prepare_rename 359.2±9.01µs 367.8±7.50µs +2.39%
rename 9.8±0.14ms 10.1±0.12ms +3.06%
semantic_tokens 1024.7±28.49µs 1039.0±17.61µs +1.40%
token_at_position 350.5±5.01µs 355.4±2.80µs +1.40%
tokens_at_position 3.7±0.08ms 3.8±0.07ms +2.70%
tokens_for_file 418.3±2.65µs 420.1±4.12µs +0.43%
traverse 42.4±1.07ms 42.3±0.61ms -0.24%

Copy link

Benchmark for a57b7ad

Click to view benchmark
Test Base PR %
code_action 5.4±0.05ms 5.1±0.14ms -5.56%
code_lens 329.9±6.78ns 334.7±14.95ns +1.45%
compile 2.9±0.03s 3.0±0.04s +3.45%
completion 4.7±0.08ms 4.6±0.03ms -2.13%
did_change_with_caching 2.8±0.05s 2.8±0.04s 0.00%
document_symbol 939.6±15.08µs 931.0±26.24µs -0.92%
format 87.9±1.68ms 87.7±1.53ms -0.23%
goto_definition 393.9±6.44µs 355.0±9.89µs -9.88%
highlight 9.0±0.21ms 8.7±0.32ms -3.33%
hover 507.4±8.32µs 473.0±10.30µs -6.78%
idents_at_position 122.3±1.32µs 122.7±2.41µs +0.33%
inlay_hints 654.1±24.83µs 644.1±26.04µs -1.53%
on_enter 495.6±14.65ns 470.8±15.62ns -5.00%
parent_decl_at_position 3.7±0.05ms 3.6±0.07ms -2.70%
prepare_rename 392.0±5.60µs 351.6±10.37µs -10.31%
rename 9.5±0.16ms 9.1±0.38ms -4.21%
semantic_tokens 1007.0±15.64µs 1028.4±26.38µs +2.13%
token_at_position 354.3±4.50µs 353.0±5.30µs -0.37%
tokens_at_position 3.7±0.04ms 3.6±0.04ms -2.70%
tokens_for_file 415.8±4.73µs 430.3±5.18µs +3.49%
traverse 40.5±1.25ms 40.9±1.05ms +0.99%

@xunilrj xunilrj requested a review from a team May 14, 2024 09:28
@xunilrj xunilrj self-assigned this May 14, 2024
@xunilrj xunilrj mentioned this pull request May 15, 2024
28 tasks
@IGI-111 IGI-111 requested a review from a team May 15, 2024 15:47
Copy link

Benchmark for 7ddc463

Click to view benchmark
Test Base PR %
code_action 5.2±0.06ms 5.4±0.05ms +3.85%
code_lens 286.9±14.65ns 283.9±7.58ns -1.05%
compile 2.9±0.04s 2.9±0.05s 0.00%
completion 4.5±0.09ms 4.7±0.13ms +4.44%
did_change_with_caching 2.9±0.07s 2.8±0.05s -3.45%
document_symbol 964.2±32.34µs 1022.5±44.35µs +6.05%
format 74.0±0.96ms 75.1±1.34ms +1.49%
goto_definition 364.1±12.32µs 370.0±5.50µs +1.62%
highlight 8.7±0.04ms 9.1±0.17ms +4.60%
hover 480.2±4.42µs 490.3±7.20µs +2.10%
idents_at_position 123.3±0.46µs 123.2±1.16µs -0.08%
inlay_hints 651.0±21.36µs 680.1±22.40µs +4.47%
on_enter 465.0±9.90ns 464.8±23.42ns -0.04%
parent_decl_at_position 3.6±0.05ms 3.7±0.05ms +2.78%
prepare_rename 362.5±7.34µs 369.0±6.89µs +1.79%
rename 9.2±0.15ms 9.6±0.16ms +4.35%
semantic_tokens 987.0±22.34µs 1000.4±19.03µs +1.36%
token_at_position 363.0±1.86µs 361.9±4.85µs -0.30%
tokens_at_position 3.6±0.07ms 3.7±0.03ms +2.78%
tokens_for_file 419.9±2.67µs 423.7±2.32µs +0.90%
traverse 40.7±1.29ms 41.1±1.59ms +0.98%

@IGI-111 IGI-111 merged commit 573a9ff into master May 20, 2024
38 checks passed
@IGI-111 IGI-111 deleted the xunilrj/fix-auto-impl-dca branch May 20, 2024 12:31
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.

3 participants