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

Faster access for configurables #6058

Merged
merged 27 commits into from
Jun 11, 2024
Merged

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented May 24, 2024

Description

This PR revamps how configurables are accessed when encoding v1 is used. Any changes for configurables with encoding v0 should be treated as bugs.

After encoding V1 was merged, every single time you accessed a configurable, we would "decode it". Apart from obvious performance problems, this also introduced semantic problems: two different references, would not point to the same memory address, which is something one would expect from sway syntax.

This was addressed in four steps:

1 - Configurable lowering to IR now comes with more data, The IR below is for a simple u8 configurable named U8.

U8 = config u8, abi_decode_in_place_50, 0x01, !15

1.1 - config name comes from the configurable itself (before it was auto-named as c0, c1 etc...);
1.2 - config type correctly follows the configurable type (after encoding v1, it was always byte slice);
1.3 - there is a new decode function that will be called to initialize this configurable (more details below);
1.4 - at last, we have the encoded bytes of the configurable value.

2 - This PR also splits TyConfigurableDecl from TyConstantDecl, and ConfigurabletExpression from ConfigurableExpressions.

This is needed because we now compile ConfigurableExpression to a new IR instruction called get_config, which is similar to get_local. So a reference to a configurable will be compiled into:

v0 = get_config ptr bool, BOOL, !261
v1 = load v0

3 - Given that configs are not writeable, and there is no way to set their value in IR, this is done when we lower IR to ASM, more specifically we are using a new ASM section called "globals", which are the writeable counterpart of the read-only data section.

The physical difference is that the read-only data section is appended at the end of the final binary which puts all the data sections outside of the writeable memory; To circumvent this and enable some globals to be writeable, we need to allocate them in the stack (the only writeable memory inside FuelVM). So, as soon as possible we allocate space for all globals with cfei, but we do not initialize them in any way, shape or form. We cannot expect their value to be zero!

In one of our tests, this is the allocation that is generated:

cfei i190                               ; stack space for globals

After this, for each config, the following virtual ASM is appended to the prologue (before the __entry fn).

addr $$arg0 data_0                      ; ptr to ANOTHER_U8 default value
addi $$arg1 $zero i1                    ; length of ANOTHER_U8 default value
addi $$arg2 $ssp i0                     ; ptr to global ANOTHER_U8 stack address
mova $$reta .72
fncall .0                               ; decode ANOTHER_U8
.72

There are two interesting parts here:

3.1 - There is a new addr virtual ASM opcode that returns the address of an item in the data section, in this case, it is the config encoded bytes.
3.2 - The address where the config lives in runtime is calculated at compile time and it is represented as addi $$arg2 $ssp i0. In this case, the first config is at $ssp + 0. The second one will packed after the first, and so on. They are NOT aligned.

The final FuelVM bytecode is as packed as one could expect:

0x00000018 CFEI 0xbe                       ;; [145, 0, 0, 190]                      <- allocate globals at the stack
0x0000001c ADDI R58 R63 0x0                ;; [80, 235, 240, 0]              <- initialize the first config
0x00000020 ADDI R57 $zero 0x1              ;; [80, 228, 0, 1]
0x00000024 ADDI R56 $ssp 0x0               ;; [80, 224, 64, 0]
0x00000028 SUB R62 $pc $is                 ;; [32, 248, 51, 0]
0x0000002c SRLI R62 R62 0x2                ;; [88, 251, 224, 2]
0x00000030 ADDI R62 R62 0x4                ;; [80, 251, 224, 4]
0x00000034 JMPF $zero 0x19b                ;; [116, 0, 1, 155]
0x00000038 ADDI R58 R63 0x8                ;; [80, 235, 240, 8]              <- initialize the second config
0x0000003c ADDI R57 $zero 0x3              ;; [80, 228, 0, 3]
0x00000040 ADDI R56 $ssp 0x1               ;; [80, 224, 64, 1]
0x00000044 SUB R62 $pc $is                 ;; [32, 248, 51, 0]
0x00000048 SRLI R62 R62 0x2                ;; [88, 251, 224, 2]
0x0000004c ADDI R62 R62 0x4                ;; [80, 251, 224, 4]
0x00000050 JMPF $zero 0x1d8 

Major code changes

1 - I had to split Constant and Configurable. This happened in both AST and the typed tree.
2 - I completely removed Configurable and a possible IR value. As a matter of fact, configurables do not exist in IR. We do have the concept of config, which only exists in two forms: the config declaration, and the get_config instruction.
3 - I moved the folder "programs" to inside "fuel" because they were not being used for other targets. I have also move the abstraction of targets away from them to the function compile_ir_context_to_finalized_asm. So the lowering from IR to asm is generic on the target as before, but the intermediary data are specific to each target.

The only "leak" is InstructionSet, which still is a enum with a variant for each target. I have changed this as this PR does not need it. But I think would make sense for its parent structure FinalizedAsm, to be target ignorant.
4 - I have also improved bytecode printing as shown above. Not we print the FuelVM instruction, registers and arguments, together with the binary in a more readable form. Together with absolute address.
5 - Up until now, all the compilation of sway to IR was done from the entry function. Any code not reachable from here would not be in the final binary. That was also true for how the suffix "_0", "_1" etc... was inserted. They were chosen as these functions were being called.

This created a problem because the configurable initialization was not necessarily also called in normal sway code. For this, I started to also use the config decode fn field as entry functions. To avoid these two generating colliding suffixes, I move the shared code into CompiledFunctionCache. This "cache" is something that we should revisit soon, but I left it untouched for now.

Internal Debugging

We have some very hard to debug algorithms. I tend to leave some commented code when I find a good place and a good "print" that helps to debug these parts. For example:

// Uncomment to debug what this optimization is doing

We may want to find a better solution for this. Maybe a combination of cargo feature and environment variable that prints these debugging snippets.

I am fine with removing them for now, but I think they would be very helpful, not only for debug, but also for snapshot tests in the future.

Binary Size

Since the introduction of encoding v1 for configurable, the binary size of test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts has exploded. Before it was around 5k, and skyrocketed to 14k. This PR alleviates this a little bit, and brings it back to 10k.

image

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 self-assigned this May 24, 2024
@xunilrj xunilrj force-pushed the xunilrj/configurables-faster-access branch from dc4306e to 18d2ef8 Compare May 24, 2024 16:43
Copy link

Benchmark for 6871543

Click to view benchmark
Test Base PR %
code_action 5.2±0.12ms 5.2±0.03ms 0.00%
code_lens 334.3±8.99ns 299.5±9.57ns -10.41%
compile 3.0±0.03s 3.1±0.03s +3.33%
completion 4.6±0.09ms 4.6±0.02ms 0.00%
did_change_with_caching 3.0±0.04s 2.9±0.05s -3.33%
document_symbol 954.6±18.48µs 1041.8±48.20µs +9.13%
format 73.0±0.48ms 74.2±1.12ms +1.64%
goto_definition 366.1±5.65µs 359.6±6.23µs -1.78%
highlight 8.7±0.13ms 8.7±0.04ms 0.00%
hover 489.3±6.32µs 484.9±6.53µs -0.90%
idents_at_position 121.6±0.32µs 120.3±0.45µs -1.07%
inlay_hints 648.1±24.05µs 664.9±16.70µs +2.59%
on_enter 459.8±12.40ns 472.9±21.55ns +2.85%
parent_decl_at_position 3.6±0.05ms 3.6±0.03ms 0.00%
prepare_rename 365.8±5.62µs 359.8±7.67µs -1.64%
rename 9.3±0.18ms 9.3±0.44ms 0.00%
semantic_tokens 955.9±14.33µs 991.0±19.92µs +3.67%
token_at_position 357.5±1.69µs 348.9±4.98µs -2.41%
tokens_at_position 3.6±0.02ms 3.6±0.03ms 0.00%
tokens_for_file 422.3±1.97µs 420.1±6.65µs -0.52%
traverse 41.8±1.19ms 41.2±1.41ms -1.44%

Copy link

Benchmark for b1f8679

Click to view benchmark
Test Base PR %
code_action 5.2±0.12ms 5.2±0.05ms 0.00%
code_lens 338.3±14.20ns 300.4±6.54ns -11.20%
compile 3.0±0.05s 3.1±0.06s +3.33%
completion 4.5±0.01ms 4.5±0.07ms 0.00%
did_change_with_caching 3.0±0.08s 3.0±0.05s 0.00%
document_symbol 991.7±25.09µs 1018.4±35.42µs +2.69%
format 73.8±1.07ms 73.2±0.93ms -0.81%
goto_definition 369.5±3.82µs 356.4±9.37µs -3.55%
highlight 8.7±0.14ms 8.6±0.27ms -1.15%
hover 487.9±3.15µs 484.0±13.86µs -0.80%
idents_at_position 125.2±3.84µs 119.2±0.75µs -4.79%
inlay_hints 651.2±28.13µs 663.0±49.16µs +1.81%
on_enter 463.9±4.80ns 461.8±9.93ns -0.45%
parent_decl_at_position 3.6±0.10ms 3.6±0.07ms 0.00%
prepare_rename 364.9±6.28µs 359.3±6.93µs -1.53%
rename 9.3±0.02ms 9.2±0.22ms -1.08%
semantic_tokens 961.1±28.20µs 1006.5±44.71µs +4.72%
token_at_position 358.5±3.49µs 341.8±3.64µs -4.66%
tokens_at_position 3.6±0.04ms 3.6±0.05ms 0.00%
tokens_for_file 422.1±3.00µs 420.7±2.63µs -0.33%
traverse 43.8±1.41ms 41.4±0.97ms -5.48%

Copy link

Benchmark for 791f062

Click to view benchmark
Test Base PR %
code_action 5.2±0.09ms 5.3±0.14ms +1.92%
code_lens 331.1±13.30ns 287.3±10.78ns -13.23%
compile 3.0±0.05s 3.0±0.04s 0.00%
completion 4.4±0.12ms 4.7±0.07ms +6.82%
did_change_with_caching 2.8±0.04s 2.8±0.05s 0.00%
document_symbol 961.9±43.57µs 948.5±34.42µs -1.39%
format 74.4±1.34ms 70.7±1.37ms -4.97%
goto_definition 364.3±9.71µs 392.0±8.92µs +7.60%
highlight 8.5±0.19ms 8.9±0.20ms +4.71%
hover 493.8±10.46µs 512.9±11.39µs +3.87%
idents_at_position 119.7±2.45µs 117.1±3.04µs -2.17%
inlay_hints 618.0±19.83µs 663.0±22.14µs +7.28%
on_enter 465.3±10.94ns 437.7±12.01ns -5.93%
parent_decl_at_position 3.5±0.07ms 3.7±0.05ms +5.71%
prepare_rename 362.3±9.38µs 378.4±12.81µs +4.44%
rename 9.1±0.50ms 9.6±0.18ms +5.49%
semantic_tokens 950.1±26.78µs 958.4±21.85µs +0.87%
token_at_position 347.7±13.73µs 406.5±4.07µs +16.91%
tokens_at_position 3.5±0.07ms 3.6±0.08ms +2.86%
tokens_for_file 413.4±7.01µs 420.5±8.05µs +1.72%
traverse 41.3±1.08ms 39.7±0.91ms -3.87%

Copy link

Benchmark for 5e71998

Click to view benchmark
Test Base PR %
code_action 5.5±0.05ms 5.2±0.05ms -5.45%
code_lens 293.9±15.98ns 284.9±7.71ns -3.06%
compile 3.2±0.05s 3.2±0.03s 0.00%
completion 4.8±0.08ms 4.6±0.32ms -4.17%
did_change_with_caching 3.0±0.04s 3.0±0.06s 0.00%
document_symbol 947.7±15.30µs 985.2±45.86µs +3.96%
format 75.1±0.96ms 73.2±3.14ms -2.53%
goto_definition 369.3±8.45µs 354.9±11.88µs -3.90%
highlight 9.1±0.12ms 8.7±0.17ms -4.40%
hover 491.7±4.58µs 479.0±6.36µs -2.58%
idents_at_position 123.3±3.30µs 121.1±0.79µs -1.78%
inlay_hints 674.5±22.75µs 662.1±34.32µs -1.84%
on_enter 464.9±11.12ns 467.5±12.48ns +0.56%
parent_decl_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
prepare_rename 361.1±4.92µs 352.3±9.03µs -2.44%
rename 10.0±0.12ms 9.5±0.22ms -5.00%
semantic_tokens 965.4±18.33µs 1000.0±19.87µs +3.58%
token_at_position 353.2±5.18µs 352.2±15.47µs -0.28%
tokens_at_position 3.8±0.06ms 3.6±0.07ms -5.26%
tokens_for_file 421.2±3.61µs 418.5±5.41µs -0.64%
traverse 42.0±1.31ms 41.8±0.83ms -0.48%

Copy link

Benchmark for e07caaf

Click to view benchmark
Test Base PR %
code_action 5.6±0.45ms 5.3±0.10ms -5.36%
code_lens 293.6±8.76ns 283.7±8.96ns -3.37%
compile 3.0±0.04s 3.2±0.04s +6.67%
completion 4.7±0.08ms 4.6±0.05ms -2.13%
did_change_with_caching 3.0±0.06s 2.9±0.06s -3.33%
document_symbol 1015.1±42.25µs 944.8±26.57µs -6.93%
format 73.7±1.14ms 72.6±1.10ms -1.49%
goto_definition 363.6±6.93µs 356.8±4.06µs -1.87%
highlight 9.1±0.34ms 8.7±0.08ms -4.40%
hover 482.0±7.86µs 482.0±3.60µs 0.00%
idents_at_position 123.6±0.34µs 123.6±1.12µs 0.00%
inlay_hints 669.4±24.54µs 654.8±20.14µs -2.18%
on_enter 506.0±6.01ns 473.1±24.38ns -6.50%
parent_decl_at_position 3.8±0.02ms 3.6±0.10ms -5.26%
prepare_rename 360.7±6.16µs 353.1±5.17µs -2.11%
rename 9.7±0.14ms 9.4±0.23ms -3.09%
semantic_tokens 962.5±37.06µs 999.0±13.95µs +3.79%
token_at_position 355.2±2.06µs 352.6±2.35µs -0.73%
tokens_at_position 3.7±0.02ms 3.6±0.03ms -2.70%
tokens_for_file 415.7±2.12µs 418.3±3.29µs +0.63%
traverse 41.6±0.89ms 42.4±1.19ms +1.92%

Copy link

Benchmark for ddb3e5e

Click to view benchmark
Test Base PR %
code_action 5.6±0.07ms 5.2±0.03ms -7.14%
code_lens 292.6±7.86ns 339.6±14.06ns +16.06%
compile 3.1±0.05s 3.1±0.03s 0.00%
completion 4.7±0.14ms 4.6±0.03ms -2.13%
did_change_with_caching 2.9±0.02s 3.0±0.04s +3.45%
document_symbol 954.5±21.13µs 967.5±12.40µs +1.36%
format 73.4±1.06ms 71.9±1.22ms -2.04%
goto_definition 363.3±6.89µs 363.1±7.73µs -0.06%
highlight 9.1±0.12ms 8.7±0.18ms -4.40%
hover 490.4±5.79µs 491.5±5.72µs +0.22%
idents_at_position 122.5±0.58µs 121.3±1.12µs -0.98%
inlay_hints 669.2±36.90µs 655.1±23.53µs -2.11%
on_enter 465.1±12.60ns 453.0±11.84ns -2.60%
parent_decl_at_position 3.7±0.03ms 3.6±0.03ms -2.70%
prepare_rename 370.8±5.77µs 365.6±10.69µs -1.40%
rename 9.8±0.04ms 9.3±0.20ms -5.10%
semantic_tokens 964.8±18.72µs 993.0±15.60µs +2.92%
token_at_position 363.0±2.66µs 353.2±3.34µs -2.70%
tokens_at_position 3.7±0.03ms 3.6±0.04ms -2.70%
tokens_for_file 419.3±2.59µs 424.8±4.30µs +1.31%
traverse 41.8±0.68ms 43.0±1.09ms +2.87%

@xunilrj xunilrj marked this pull request as ready for review May 28, 2024 14:46
@xunilrj xunilrj requested a review from kayagokalp as a code owner May 28, 2024 14:46
@xunilrj xunilrj requested a review from a team May 28, 2024 14:46
@xunilrj xunilrj force-pushed the xunilrj/configurables-faster-access branch from f941425 to 58b20cd Compare May 29, 2024 07:44
Copy link

Benchmark for 3ce7a03

Click to view benchmark
Test Base PR %
code_action 5.3±0.12ms 5.2±0.11ms -1.89%
code_lens 287.8±9.08ns 285.1±10.89ns -0.94%
compile 3.1±0.05s 3.1±0.06s 0.00%
completion 4.6±0.10ms 4.6±0.06ms 0.00%
did_change_with_caching 2.9±0.05s 3.0±0.04s +3.45%
document_symbol 1023.8±43.82µs 958.2±19.11µs -6.41%
format 73.8±0.51ms 72.5±3.35ms -1.76%
goto_definition 369.2±7.01µs 356.7±3.53µs -3.39%
highlight 8.7±0.09ms 8.6±0.02ms -1.15%
hover 488.0±4.81µs 501.2±6.26µs +2.70%
idents_at_position 122.2±0.77µs 120.7±0.56µs -1.23%
inlay_hints 657.2±18.36µs 658.6±9.12µs +0.21%
on_enter 482.1±5.71ns 465.6±15.87ns -3.42%
parent_decl_at_position 3.6±0.04ms 3.6±0.02ms 0.00%
prepare_rename 369.3±6.45µs 353.8±5.63µs -4.20%
rename 9.4±0.04ms 9.2±0.15ms -2.13%
semantic_tokens 973.4±8.97µs 977.7±7.47µs +0.44%
token_at_position 359.1±2.64µs 350.6±2.76µs -2.37%
tokens_at_position 3.6±0.04ms 3.6±0.06ms 0.00%
tokens_for_file 418.8±3.54µs 424.3±2.65µs +1.31%
traverse 41.9±1.26ms 42.3±1.04ms +0.95%

@xunilrj xunilrj force-pushed the xunilrj/configurables-faster-access branch from 58b20cd to 745b813 Compare May 29, 2024 14:33
Copy link

Benchmark for 5288600

Click to view benchmark
Test Base PR %
code_action 5.3±0.10ms 5.3±0.13ms 0.00%
code_lens 311.6±11.23ns 285.3±8.88ns -8.44%
compile 3.1±0.11s 3.1±0.07s 0.00%
completion 4.6±0.14ms 4.6±0.03ms 0.00%
did_change_with_caching 3.0±0.05s 3.2±0.07s +6.67%
document_symbol 1044.4±32.32µs 1012.2±54.46µs -3.08%
format 74.2±1.33ms 72.6±0.96ms -2.16%
goto_definition 366.0±4.76µs 355.3±5.71µs -2.92%
highlight 8.8±0.19ms 8.7±0.15ms -1.14%
hover 488.8±7.78µs 487.1±8.35µs -0.35%
idents_at_position 124.3±0.56µs 119.4±1.61µs -3.94%
inlay_hints 652.9±28.26µs 659.8±46.97µs +1.06%
on_enter 484.1±8.44ns 479.2±11.96ns -1.01%
parent_decl_at_position 3.6±0.05ms 3.7±0.07ms +2.78%
prepare_rename 364.9±12.12µs 365.8±4.63µs +0.25%
rename 9.3±0.06ms 9.5±0.29ms +2.15%
semantic_tokens 997.4±18.98µs 970.8±22.82µs -2.67%
token_at_position 358.4±4.78µs 348.3±3.71µs -2.82%
tokens_at_position 3.6±0.04ms 3.7±0.04ms +2.78%
tokens_for_file 420.6±3.33µs 427.8±3.63µs +1.71%
traverse 41.8±1.29ms 43.7±0.59ms +4.55%

Copy link

Benchmark for 6de0df3

Click to view benchmark
Test Base PR %
code_action 5.2±0.08ms 5.2±0.08ms 0.00%
code_lens 288.2±6.81ns 310.5±11.52ns +7.74%
compile 3.0±0.05s 3.1±0.07s +3.33%
completion 4.6±0.03ms 4.5±0.07ms -2.17%
did_change_with_caching 2.9±0.04s 2.9±0.03s 0.00%
document_symbol 1008.3±35.25µs 952.8±12.19µs -5.50%
format 74.1±1.01ms 72.6±2.17ms -2.02%
goto_definition 373.5±5.90µs 357.5±9.67µs -4.28%
highlight 8.8±0.21ms 8.7±0.17ms -1.14%
hover 492.8±7.93µs 482.3±6.39µs -2.13%
idents_at_position 124.9±1.13µs 119.3±1.63µs -4.48%
inlay_hints 651.4±8.43µs 647.9±24.14µs -0.54%
on_enter 486.3±18.11ns 474.5±15.00ns -2.43%
parent_decl_at_position 3.6±0.03ms 3.6±0.03ms 0.00%
prepare_rename 366.8±4.08µs 356.1±6.47µs -2.92%
rename 9.3±0.14ms 9.2±0.17ms -1.08%
semantic_tokens 974.3±20.54µs 972.4±13.95µs -0.20%
token_at_position 361.5±4.71µs 347.3±4.38µs -3.93%
tokens_at_position 3.6±0.06ms 3.6±0.02ms 0.00%
tokens_for_file 423.1±4.20µs 419.9±2.60µs -0.76%
traverse 41.5±0.96ms 41.3±0.94ms -0.48%

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

Benchmark for 78807b1

Click to view benchmark
Test Base PR %
code_action 5.2±0.02ms 5.5±0.05ms +5.77%
code_lens 295.7±8.61ns 294.2±7.19ns -0.51%
compile 3.0±0.06s 3.1±0.03s +3.33%
completion 4.6±0.21ms 4.7±0.03ms +2.17%
did_change_with_caching 2.9±0.04s 3.0±0.03s +3.45%
document_symbol 994.9±49.78µs 955.5±9.82µs -3.96%
format 73.1±1.35ms 72.8±1.11ms -0.41%
goto_definition 361.7±4.82µs 369.0±5.64µs +2.02%
highlight 8.7±0.18ms 9.2±0.14ms +5.75%
hover 492.8±13.04µs 489.8±7.16µs -0.61%
idents_at_position 122.3±0.25µs 122.9±0.93µs +0.49%
inlay_hints 644.3±22.99µs 669.3±10.80µs +3.88%
on_enter 487.9±14.25ns 460.5±20.08ns -5.62%
parent_decl_at_position 3.6±0.07ms 3.7±0.01ms +2.78%
prepare_rename 365.2±23.14µs 364.6±23.29µs -0.16%
rename 9.3±0.07ms 9.8±0.18ms +5.38%
semantic_tokens 975.2±18.62µs 968.5±14.30µs -0.69%
token_at_position 355.9±2.33µs 353.8±5.49µs -0.59%
tokens_at_position 3.6±0.03ms 3.7±0.04ms +2.78%
tokens_for_file 426.4±4.72µs 424.0±2.15µs -0.56%
traverse 41.7±1.14ms 41.9±1.53ms +0.48%

@xunilrj xunilrj force-pushed the xunilrj/configurables-faster-access branch from ab23d8d to 858cfcc Compare May 31, 2024 14:24
@xunilrj xunilrj requested a review from JoshuaBatty as a code owner May 31, 2024 14:24
Copy link

Benchmark for 6a24095

Click to view benchmark
Test Base PR %
code_action 5.4±0.24ms 5.4±0.29ms 0.00%
code_lens 343.2±35.03ns 282.2±10.75ns -17.77%
compile 3.2±0.06s 3.2±0.07s 0.00%
completion 4.7±0.21ms 4.8±0.24ms +2.13%
did_change_with_caching 3.1±0.04s 3.0±0.05s -3.23%
document_symbol 1035.4±23.00µs 958.6±30.00µs -7.42%
format 74.3±0.98ms 73.2±1.38ms -1.48%
goto_definition 368.4±9.70µs 374.0±6.87µs +1.52%
highlight 8.8±0.12ms 8.9±0.31ms +1.14%
hover 496.6±17.04µs 501.7±5.53µs +1.03%
idents_at_position 123.2±0.53µs 123.5±1.30µs +0.24%
inlay_hints 658.0±25.70µs 668.2±16.14µs +1.55%
on_enter 473.3±14.09ns 466.4±12.48ns -1.46%
parent_decl_at_position 3.6±0.06ms 3.6±0.06ms 0.00%
prepare_rename 365.9±7.52µs 378.3±10.28µs +3.39%
rename 9.6±0.29ms 9.7±0.35ms +1.04%
semantic_tokens 991.7±22.97µs 1007.6±27.96µs +1.60%
token_at_position 365.3±4.26µs 358.3±6.12µs -1.92%
tokens_at_position 3.6±0.05ms 3.6±0.07ms 0.00%
tokens_for_file 433.8±4.52µs 424.8±6.87µs -2.07%
traverse 44.2±1.49ms 44.3±1.07ms +0.23%

tritao
tritao previously approved these changes May 31, 2024
Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

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

A couple nits, but looks good (mostly skimmed through the codegen/IR parts though)

@xunilrj xunilrj dismissed stale reviews from K1-R1, IGI-111, and tritao via a71997b June 10, 2024 08:10
@xunilrj xunilrj force-pushed the xunilrj/configurables-faster-access branch from 1789030 to a71997b Compare June 10, 2024 08:10
Copy link

Benchmark for 4482f5b

Click to view benchmark
Test Base PR %
code_action 5.3±0.22ms 5.3±0.14ms 0.00%
code_lens 288.5±10.19ns 347.9±11.59ns +20.59%
compile 4.1±0.12s 4.1±0.10s 0.00%
completion 4.6±0.03ms 4.6±0.09ms 0.00%
did_change_with_caching 3.7±0.08s 3.9±0.08s +5.41%
document_symbol 987.6±40.76µs 991.8±34.46µs +0.43%
format 72.0±0.92ms 88.5±1.45ms +22.92%
goto_definition 383.7±2.56µs 371.9±5.64µs -3.08%
highlight 8.9±0.02ms 8.7±0.20ms -2.25%
hover 559.6±8.28µs 552.7±8.09µs -1.23%
idents_at_position 123.6±1.86µs 125.3±1.29µs +1.38%
inlay_hints 648.3±11.04µs 671.2±40.31µs +3.53%
on_enter 469.7±14.30ns 451.7±11.49ns -3.83%
parent_decl_at_position 3.6±0.02ms 3.6±0.07ms 0.00%
prepare_rename 384.2±5.36µs 371.5±6.41µs -3.31%
rename 9.4±0.20ms 9.4±0.28ms 0.00%
semantic_tokens 950.7±13.67µs 982.1±8.31µs +3.30%
token_at_position 366.1±8.22µs 362.7±10.94µs -0.93%
tokens_at_position 3.6±0.03ms 3.6±0.08ms 0.00%
tokens_for_file 423.6±4.44µs 420.0±2.12µs -0.85%
traverse 40.5±0.81ms 41.0±1.44ms +1.23%

Copy link

Benchmark for eb64706

Click to view benchmark
Test Base PR %
code_action 5.3±0.04ms 5.4±0.13ms +1.89%
code_lens 287.0±11.30ns 351.9±17.12ns +22.61%
compile 4.0±0.09s 4.2±0.13s +5.00%
completion 4.7±0.16ms 4.7±0.02ms 0.00%
did_change_with_caching 3.7±0.07s 3.8±0.08s +2.70%
document_symbol 963.8±10.35µs 955.4±8.81µs -0.87%
format 70.6±0.54ms 89.2±1.51ms +26.35%
goto_definition 369.8±9.85µs 372.5±16.85µs +0.73%
highlight 8.7±0.04ms 8.8±0.22ms +1.15%
hover 556.1±11.96µs 580.7±4.21µs +4.42%
idents_at_position 122.6±0.34µs 123.9±0.49µs +1.06%
inlay_hints 659.6±28.29µs 674.0±26.98µs +2.18%
on_enter 461.4±27.77ns 459.4±31.07ns -0.43%
parent_decl_at_position 3.6±0.03ms 3.6±0.04ms 0.00%
prepare_rename 371.0±7.32µs 372.8±12.08µs +0.49%
rename 9.3±0.23ms 9.8±0.32ms +5.38%
semantic_tokens 945.4±15.78µs 980.9±18.20µs +3.76%
token_at_position 360.1±2.20µs 358.3±1.63µs -0.50%
tokens_at_position 3.6±0.05ms 3.6±0.01ms 0.00%
tokens_for_file 426.9±1.81µs 422.9±5.06µs -0.94%
traverse 40.0±1.58ms 41.5±1.70ms +3.75%

@xunilrj xunilrj requested review from tritao, IGI-111 and K1-R1 June 10, 2024 11:18
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

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

The tooling-related changes look good to me.

Copy link

Benchmark for f104691

Click to view benchmark
Test Base PR %
code_action 5.1±0.02ms 5.1±0.10ms 0.00%
code_lens 287.5±8.34ns 344.4±7.39ns +19.79%
compile 3.4±0.05s 3.4±0.09s 0.00%
completion 4.7±0.10ms 4.7±0.01ms 0.00%
did_change_with_caching 3.1±0.04s 3.2±0.09s +3.23%
document_symbol 960.7±11.75µs 967.9±36.00µs +0.75%
format 71.4±0.59ms 88.6±0.53ms +24.09%
goto_definition 358.1±5.88µs 365.2±3.11µs +1.98%
highlight 8.7±0.04ms 8.7±0.15ms 0.00%
hover 584.4±6.79µs 591.6±6.41µs +1.23%
idents_at_position 120.2±1.13µs 119.5±0.39µs -0.58%
inlay_hints 645.9±13.64µs 659.2±12.76µs +2.06%
on_enter 464.8±11.60ns 449.4±7.79ns -3.31%
parent_decl_at_position 3.6±0.03ms 3.6±0.04ms 0.00%
prepare_rename 360.7±7.36µs 363.5±9.02µs +0.78%
rename 9.0±0.39ms 9.0±0.22ms 0.00%
semantic_tokens 957.2±24.48µs 971.9±23.21µs +1.54%
token_at_position 356.5±3.07µs 353.0±3.08µs -0.98%
tokens_at_position 3.6±0.04ms 3.6±0.03ms 0.00%
tokens_for_file 418.1±3.87µs 411.8±1.67µs -1.51%
traverse 36.5±0.83ms 36.7±1.03ms +0.55%

@IGI-111 IGI-111 merged commit ba0d2d7 into master Jun 11, 2024
38 checks passed
@IGI-111 IGI-111 deleted the xunilrj/configurables-faster-access branch June 11, 2024 09:28
@xunilrj xunilrj mentioned this pull request Jul 8, 2024
28 tasks
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.

None yet

5 participants