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

ABI hash based ids for Logs. #5980

Merged
merged 18 commits into from May 17, 2024
Merged

ABI hash based ids for Logs. #5980

merged 18 commits into from May 17, 2024

Conversation

esdrubal
Copy link
Contributor

@esdrubal esdrubal commented May 9, 2024

Description

Changes LogId to contain hash based on abi str.

    __log(1u32);         // hashed: "u32"
    __log((1u32, 1u64)); // hashed: "(u32, u64)"
    __log([0u64]);       // hashed: "[u64; 1]"
    __log(Some(0u64));   // hashed: "enum std::option::Option<u64>"
    __log(SS{
        ss: 1u64
    });                  // hashed: "struct SS<u64>"

Adds abi_hash_ids flag to command line tools.

Closes #5953

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 May 9, 2024

Benchmark for 552a2c5

Click to view benchmark
Test Base PR %
code_action 5.5±0.06ms 5.3±0.10ms -3.64%
code_lens 289.9±6.29ns 285.8±4.29ns -1.41%
compile 6.7±0.09s 6.7±0.15s 0.00%
completion 5.0±0.06ms 4.8±0.02ms -4.00%
did_change_with_caching 6.2±0.04s 6.2±0.09s 0.00%
document_symbol 952.7±49.56µs 970.8±27.81µs +1.90%
format 87.4±1.25ms 89.9±1.28ms +2.86%
goto_definition 351.7±6.03µs 351.9±4.34µs +0.06%
highlight 9.1±0.07ms 8.7±0.16ms -4.40%
hover 590.7±13.36µs 587.8±3.30µs -0.49%
idents_at_position 119.2±0.62µs 120.7±0.81µs +1.26%
inlay_hints 670.5±19.31µs 648.1±26.60µs -3.34%
on_enter 494.9±4.16ns 491.3±10.59ns -0.73%
parent_decl_at_position 3.7±0.02ms 3.6±0.04ms -2.70%
prepare_rename 352.8±6.63µs 348.1±5.99µs -1.33%
rename 9.6±0.14ms 9.3±0.16ms -3.12%
semantic_tokens 1042.9±9.57µs 1071.7±21.77µs +2.76%
token_at_position 346.1±1.34µs 343.8±2.44µs -0.66%
tokens_at_position 3.7±0.05ms 3.6±0.02ms -2.70%
tokens_for_file 423.8±3.72µs 416.3±2.76µs -1.77%
traverse 50.6±1.14ms 50.8±1.60ms +0.40%

@esdrubal esdrubal self-assigned this May 14, 2024
@esdrubal esdrubal added the ABI Everything to do the ABI, especially the JSON representation label May 14, 2024
Copy link

Benchmark for 7ee485e

Click to view benchmark
Test Base PR %
code_action 5.2±0.08ms 5.4±0.07ms +3.85%
code_lens 297.4±14.54ns 286.3±5.73ns -3.73%
compile 2.9±0.02s 2.9±0.05s 0.00%
completion 4.6±0.09ms 4.7±0.06ms +2.17%
did_change_with_caching 2.8±0.06s 2.8±0.04s 0.00%
document_symbol 981.6±12.96µs 1015.3±44.39µs +3.43%
format 71.1±0.72ms 87.7±1.16ms +23.35%
goto_definition 395.7±5.64µs 373.7±15.25µs -5.56%
highlight 8.9±0.16ms 9.1±0.01ms +2.25%
hover 488.4±7.94µs 499.1±23.26µs +2.19%
idents_at_position 122.5±0.34µs 123.4±0.53µs +0.73%
inlay_hints 660.3±19.50µs 670.1±8.54µs +1.48%
on_enter 495.3±26.96ns 499.8±14.85ns +0.91%
parent_decl_at_position 3.6±0.03ms 3.7±0.03ms +2.78%
prepare_rename 372.4±5.57µs 368.6±5.75µs -1.02%
rename 9.3±0.01ms 9.6±0.12ms +3.23%
semantic_tokens 1024.3±11.17µs 1045.4±11.15µs +2.06%
token_at_position 370.5±2.27µs 367.5±2.03µs -0.81%
tokens_at_position 3.6±0.04ms 3.7±0.03ms +2.78%
tokens_for_file 434.3±2.56µs 434.2±10.94µs -0.02%
traverse 40.7±1.06ms 40.9±1.26ms +0.49%

Copy link

Benchmark for 581883d

Click to view benchmark
Test Base PR %
code_action 5.4±0.11ms 5.2±0.03ms -3.70%
code_lens 336.2±12.27ns 296.3±6.78ns -11.87%
compile 3.0±0.05s 2.9±0.03s -3.33%
completion 4.8±0.04ms 4.6±0.08ms -4.17%
did_change_with_caching 2.8±0.03s 2.8±0.05s 0.00%
document_symbol 1032.9±22.73µs 922.3±27.48µs -10.71%
format 76.7±0.56ms 77.1±2.63ms +0.52%
goto_definition 367.9±11.36µs 364.3±6.75µs -0.98%
highlight 9.1±0.17ms 8.7±0.14ms -4.40%
hover 488.4±6.94µs 483.9±7.32µs -0.92%
idents_at_position 122.7±0.29µs 122.7±0.57µs 0.00%
inlay_hints 700.4±25.93µs 656.8±23.49µs -6.23%
on_enter 502.3±41.43ns 484.1±16.33ns -3.62%
parent_decl_at_position 3.7±0.08ms 3.6±0.05ms -2.70%
prepare_rename 372.0±7.55µs 364.2±4.54µs -2.10%
rename 9.7±0.24ms 9.2±0.16ms -5.15%
semantic_tokens 1021.8±19.09µs 1055.3±10.33µs +3.28%
token_at_position 366.2±2.29µs 357.8±3.43µs -2.29%
tokens_at_position 3.8±0.09ms 3.6±0.08ms -5.26%
tokens_for_file 432.2±1.24µs 420.9±2.34µs -2.61%
traverse 40.9±0.90ms 40.4±0.92ms -1.22%

```
    __log(1u32);         // hashed: "u32"
    __log((1u32, 1u64)); // hashed: "(u32, u64)"
    __log([0u64]);       // hashed: "[u64; 1]"
    __log(Some(0u64));   // hashed: "enum std::option::Option<u64>"
    __log(SS{
        ss: 1u64
    });                  // hashed: "struct SS<u64>"
```
Copy link

Benchmark for a78e061

Click to view benchmark
Test Base PR %
code_action 5.4±0.18ms 5.2±0.11ms -3.70%
code_lens 336.6±9.03ns 295.4±8.59ns -12.24%
compile 2.9±0.03s 3.0±0.04s +3.45%
completion 4.9±0.51ms 4.5±0.01ms -8.16%
did_change_with_caching 2.9±0.05s 2.9±0.07s 0.00%
document_symbol 923.3±26.00µs 943.2±24.15µs +2.16%
format 76.2±0.78ms 78.1±1.95ms +2.49%
goto_definition 355.8±6.26µs 390.4±82.15µs +9.72%
highlight 9.0±0.01ms 8.7±0.26ms -3.33%
hover 480.6±20.08µs 493.6±5.86µs +2.70%
idents_at_position 124.8±1.59µs 124.0±1.48µs -0.64%
inlay_hints 652.3±19.80µs 655.8±25.18µs +0.54%
on_enter 495.3±12.30ns 488.5±17.14ns -1.37%
parent_decl_at_position 3.7±0.09ms 3.6±0.04ms -2.70%
prepare_rename 353.2±3.32µs 369.5±7.63µs +4.61%
rename 9.9±0.27ms 9.4±0.24ms -5.05%
semantic_tokens 1064.3±16.97µs 1023.2±19.47µs -3.86%
token_at_position 365.2±2.92µs 368.3±2.73µs +0.85%
tokens_at_position 3.7±0.09ms 3.6±0.12ms -2.70%
tokens_for_file 428.1±1.54µs 414.6±4.27µs -3.15%
traverse 42.4±1.34ms 41.7±1.37ms -1.65%

Copy link

Benchmark for 52d5f3a

Click to view benchmark
Test Base PR %
code_action 5.4±0.19ms 5.2±0.07ms -3.70%
code_lens 349.3±5.52ns 312.8±5.49ns -10.45%
compile 2.9±0.04s 2.9±0.04s 0.00%
completion 4.7±0.02ms 4.6±0.03ms -2.13%
did_change_with_caching 2.8±0.03s 2.8±0.04s 0.00%
document_symbol 910.4±8.80µs 939.6±19.28µs +3.21%
format 76.4±1.38ms 76.2±4.17ms -0.26%
goto_definition 367.0±5.97µs 371.8±8.13µs +1.31%
highlight 9.0±0.41ms 8.7±0.18ms -3.33%
hover 483.6±9.98µs 484.3±5.87µs +0.14%
idents_at_position 123.0±0.34µs 123.8±0.91µs +0.65%
inlay_hints 669.2±32.84µs 645.9±10.96µs -3.48%
on_enter 497.4±7.94ns 482.8±26.32ns -2.94%
parent_decl_at_position 3.7±0.04ms 3.6±0.05ms -2.70%
prepare_rename 369.8±18.00µs 368.1±17.12µs -0.46%
rename 9.6±0.17ms 9.2±0.13ms -4.17%
semantic_tokens 1000.5±17.99µs 1033.1±31.43µs +3.26%
token_at_position 355.4±2.95µs 360.7±2.56µs +1.49%
tokens_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
tokens_for_file 429.0±1.75µs 422.1±3.65µs -1.61%
traverse 40.8±0.66ms 40.5±1.61ms -0.74%

Copy link

Benchmark for f76cb85

Click to view benchmark
Test Base PR %
code_action 5.3±0.10ms 5.3±0.21ms 0.00%
code_lens 334.6±9.54ns 296.5±10.85ns -11.39%
compile 2.9±0.05s 2.9±0.03s 0.00%
completion 4.7±0.05ms 4.6±0.07ms -2.13%
did_change_with_caching 2.8±0.06s 2.8±0.05s 0.00%
document_symbol 988.3±17.34µs 955.8±49.34µs -3.29%
format 76.1±0.55ms 76.3±0.86ms +0.26%
goto_definition 360.5±9.87µs 363.2±4.30µs +0.75%
highlight 9.0±0.04ms 8.7±0.17ms -3.33%
hover 477.9±7.62µs 478.7±9.77µs +0.17%
idents_at_position 123.2±0.87µs 121.8±0.95µs -1.14%
inlay_hints 674.9±30.38µs 646.8±31.39µs -4.16%
on_enter 486.4±11.09ns 485.9±31.22ns -0.10%
parent_decl_at_position 3.7±0.07ms 3.7±0.10ms 0.00%
prepare_rename 360.3±6.75µs 367.5±7.98µs +2.00%
rename 9.6±0.16ms 9.2±0.17ms -4.17%
semantic_tokens 1004.8±19.59µs 1045.1±11.26µs +4.01%
token_at_position 360.3±3.22µs 402.7±2.11µs +11.77%
tokens_at_position 3.7±0.03ms 3.6±0.03ms -2.70%
tokens_for_file 432.6±1.96µs 417.1±3.88µs -3.58%
traverse 41.0±1.13ms 40.6±1.17ms -0.98%

Copy link

Benchmark for b14774f

Click to view benchmark
Test Base PR %
code_action 5.4±0.12ms 5.2±0.02ms -3.70%
code_lens 335.5±6.46ns 295.2±8.34ns -12.01%
compile 3.0±0.02s 2.9±0.03s -3.33%
completion 4.7±0.10ms 4.6±0.09ms -2.13%
did_change_with_caching 2.8±0.03s 2.8±0.05s 0.00%
document_symbol 989.0±56.56µs 997.8±43.01µs +0.89%
format 76.9±1.50ms 76.7±0.56ms -0.26%
goto_definition 362.1±8.84µs 362.3±8.52µs +0.06%
highlight 9.0±0.24ms 8.8±0.52ms -2.22%
hover 488.8±5.31µs 483.7±6.77µs -1.04%
idents_at_position 123.4±0.48µs 122.7±1.41µs -0.57%
inlay_hints 661.2±23.54µs 648.7±17.45µs -1.89%
on_enter 490.8±12.11ns 480.8±16.24ns -2.04%
parent_decl_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
prepare_rename 354.9±7.56µs 363.5±7.55µs +2.42%
rename 9.7±0.65ms 9.2±0.17ms -5.15%
semantic_tokens 1068.4±18.51µs 1014.4±42.54µs -5.05%
token_at_position 357.9±2.71µs 356.9±2.45µs -0.28%
tokens_at_position 3.7±0.03ms 3.6±0.09ms -2.70%
tokens_for_file 494.7±3.15µs 418.3±5.21µs -15.44%
traverse 41.1±1.12ms 41.1±1.39ms 0.00%

Copy link

Benchmark for 13f6d80

Click to view benchmark
Test Base PR %
code_action 5.4±0.05ms 5.2±0.08ms -3.70%
code_lens 336.9±6.84ns 293.8±7.90ns -12.79%
compile 3.1±0.05s 3.1±0.03s 0.00%
completion 4.7±0.08ms 4.7±0.09ms 0.00%
did_change_with_caching 2.9±0.03s 2.9±0.06s 0.00%
document_symbol 921.1±23.85µs 919.9±10.27µs -0.13%
format 77.6±1.05ms 78.1±1.09ms +0.64%
goto_definition 359.4±5.92µs 368.1±7.27µs +2.42%
highlight 9.0±0.04ms 8.7±0.06ms -3.33%
hover 484.6±8.54µs 491.1±7.39µs +1.34%
idents_at_position 122.6±0.49µs 123.0±0.82µs +0.33%
inlay_hints 659.5±8.19µs 654.5±19.64µs -0.76%
on_enter 488.7±18.28ns 485.4±16.89ns -0.68%
parent_decl_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
prepare_rename 361.4±5.49µs 370.7±9.92µs +2.57%
rename 9.7±0.18ms 9.3±0.19ms -4.12%
semantic_tokens 1038.2±24.41µs 1033.0±31.41µs -0.50%
token_at_position 374.6±2.07µs 361.2±3.62µs -3.58%
tokens_at_position 3.7±0.04ms 3.6±0.05ms -2.70%
tokens_for_file 465.7±1.52µs 422.8±2.54µs -9.21%
traverse 41.9±0.94ms 41.7±0.95ms -0.48%

@esdrubal esdrubal marked this pull request as ready for review May 15, 2024 13:07
@esdrubal esdrubal requested a review from kayagokalp as a code owner May 15, 2024 13:07
@esdrubal esdrubal requested a review from a team May 15, 2024 13:08
Copy link

Benchmark for 0b734ac

Click to view benchmark
Test Base PR %
code_action 5.2±0.08ms 5.2±0.11ms 0.00%
code_lens 292.5±11.30ns 326.6±8.11ns +11.66%
compile 2.9±0.03s 2.9±0.03s 0.00%
completion 4.6±0.05ms 4.6±0.38ms 0.00%
did_change_with_caching 2.8±0.03s 2.8±0.05s 0.00%
document_symbol 954.9±29.46µs 1007.9±35.69µs +5.55%
format 71.1±1.11ms 71.9±1.28ms +1.13%
goto_definition 368.0±13.48µs 366.1±6.57µs -0.52%
highlight 8.7±0.04ms 8.7±0.12ms 0.00%
hover 490.3±32.40µs 504.7±5.64µs +2.94%
idents_at_position 123.4±0.56µs 122.7±0.73µs -0.57%
inlay_hints 655.9±17.37µs 650.7±21.61µs -0.79%
on_enter 474.8±16.94ns 473.7±11.99ns -0.23%
parent_decl_at_position 3.6±0.03ms 3.6±0.02ms 0.00%
prepare_rename 362.1±7.11µs 368.4±4.39µs +1.74%
rename 9.2±0.17ms 9.2±0.14ms 0.00%
semantic_tokens 969.6±15.40µs 974.9±32.56µs +0.55%
token_at_position 357.6±2.98µs 366.3±3.09µs +2.43%
tokens_at_position 3.6±0.04ms 3.6±0.05ms 0.00%
tokens_for_file 418.6±2.70µs 420.3±3.18µs +0.41%
traverse 41.0±1.14ms 41.0±0.95ms 0.00%

forc-test/src/lib.rs Outdated Show resolved Hide resolved
Copy link

Benchmark for 2d00ac2

Click to view benchmark
Test Base PR %
code_action 5.4±0.04ms 5.2±0.08ms -3.70%
code_lens 298.5±17.96ns 290.1±10.45ns -2.81%
compile 2.9±0.03s 3.0±0.08s +3.45%
completion 4.8±0.19ms 4.6±0.03ms -4.17%
did_change_with_caching 2.8±0.03s 2.8±0.05s 0.00%
document_symbol 964.4±13.17µs 978.7±20.04µs +1.48%
format 84.1±1.20ms 72.5±1.57ms -13.79%
goto_definition 361.0±3.70µs 361.6±8.32µs +0.17%
highlight 9.1±0.09ms 8.7±0.17ms -4.40%
hover 486.9±6.86µs 482.4±7.37µs -0.92%
idents_at_position 122.2±0.32µs 123.4±0.42µs +0.98%
inlay_hints 665.2±20.52µs 650.1±17.29µs -2.27%
on_enter 477.4±13.11ns 501.9±9.98ns +5.13%
parent_decl_at_position 3.7±0.02ms 3.6±0.04ms -2.70%
prepare_rename 361.7±4.89µs 362.0±7.66µs +0.08%
rename 9.6±0.04ms 9.3±0.22ms -3.12%
semantic_tokens 953.4±28.17µs 972.5±18.09µs +2.00%
token_at_position 358.6±2.83µs 356.8±3.15µs -0.50%
tokens_at_position 3.7±0.02ms 3.6±0.03ms -2.70%
tokens_for_file 418.8±3.42µs 419.1±1.87µs +0.07%
traverse 40.7±1.22ms 41.3±1.30ms +1.47%

Copy link

Benchmark for 8ce797a

Click to view benchmark
Test Base PR %
code_action 5.7±0.32ms 5.2±0.02ms -8.77%
code_lens 294.8±9.29ns 293.5±10.44ns -0.44%
compile 3.1±0.09s 3.1±0.03s 0.00%
completion 4.7±0.06ms 4.6±0.08ms -2.13%
did_change_with_caching 2.9±0.05s 2.9±0.03s 0.00%
document_symbol 956.0±34.88µs 1005.6±47.11µs +5.19%
format 86.4±0.97ms 73.6±1.81ms -14.81%
goto_definition 434.5±5.54µs 365.5±6.49µs -15.88%
highlight 9.2±0.09ms 8.8±0.18ms -4.35%
hover 554.2±5.97µs 486.2±15.32µs -12.27%
idents_at_position 123.2±0.39µs 123.0±2.47µs -0.16%
inlay_hints 666.3±14.88µs 651.4±11.25µs -2.24%
on_enter 484.1±10.97ns 476.2±14.60ns -1.63%
parent_decl_at_position 3.7±0.04ms 3.6±0.03ms -2.70%
prepare_rename 435.1±5.69µs 364.5±5.01µs -16.23%
rename 10.1±0.27ms 9.3±0.22ms -7.92%
semantic_tokens 960.5±24.15µs 960.8±18.55µs +0.03%
token_at_position 359.4±3.50µs 360.6±2.54µs +0.33%
tokens_at_position 3.7±0.03ms 3.6±0.06ms -2.70%
tokens_for_file 423.9±1.96µs 419.6±10.22µs -1.01%
traverse 41.7±1.20ms 41.1±0.59ms -1.44%

@IGI-111 IGI-111 requested review from arboleya, Voxelot, kayagokalp and a team May 17, 2024 07:02
Copy link

Benchmark for 64e2b77

Click to view benchmark
Test Base PR %
code_action 5.2±0.03ms 5.4±0.06ms +3.85%
code_lens 290.3±7.46ns 291.5±8.46ns +0.41%
compile 2.9±0.03s 3.0±0.04s +3.45%
completion 4.6±0.09ms 4.7±0.09ms +2.17%
did_change_with_caching 2.9±0.02s 2.9±0.03s 0.00%
document_symbol 1037.5±15.95µs 948.8±14.32µs -8.55%
format 85.3±1.22ms 72.5±1.32ms -15.01%
goto_definition 367.1±3.77µs 365.6±8.67µs -0.41%
highlight 8.7±0.16ms 9.0±0.18ms +3.45%
hover 489.3±19.40µs 481.4±7.90µs -1.61%
idents_at_position 123.8±0.39µs 123.7±0.89µs -0.08%
inlay_hints 653.8±28.98µs 663.5±23.65µs +1.48%
on_enter 487.6±20.65ns 513.6±16.17ns +5.33%
parent_decl_at_position 3.6±0.01ms 3.7±0.10ms +2.78%
prepare_rename 364.7±5.81µs 361.7±6.50µs -0.82%
rename 9.3±0.13ms 9.6±0.28ms +3.23%
semantic_tokens 970.2±17.22µs 973.6±17.57µs +0.35%
token_at_position 358.7±2.19µs 361.0±2.26µs +0.64%
tokens_at_position 3.6±0.05ms 3.7±0.02ms +2.78%
tokens_for_file 418.1±2.11µs 421.9±2.22µs +0.91%
traverse 41.1±1.17ms 40.8±1.43ms -0.73%

@IGI-111 IGI-111 requested a review from nedsalk May 17, 2024 10:11
Copy link

@nedsalk nedsalk left a comment

Choose a reason for hiding this comment

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

I tried out the branch locally with the TS-SDK and it worked. Approving as-is after chat with @IGI-111.

@IGI-111 IGI-111 merged commit 8002037 into master May 17, 2024
38 checks passed
@IGI-111 IGI-111 deleted the esdrubal/abi_hash_ids branch May 17, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ABI Everything to do the ABI, especially the JSON representation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit tags in LOG and LOGD
6 participants