perf(semantic): use match_module_declaration! macro instead of match guard#17184
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #17184 will not alter performanceComparing Summary
Footnotes
|
|
How are you finding these things? |
Claude 😉 I asked it to analyze the built assembly of oxc_semantic example and look for stuff |
Merge activity
|
…guard (#17184) Replaces the match guard pattern that calls `is_module_declaration()` for every AST node with the `match_module_declaration!` macro for direct pattern matching. Before: ```asm example::check_before::hfc46178bb9b4d182: cmp rdi, 7 ja .LBB1_11 lea rax, [rip + .LJTI1_0] movsxd rcx, dword ptr [rax + 4*rdi] add rcx, rax jmp rcx .LBB1_2: mov rdi, rsi jmp example::check_program::hdcbd5472c2f04f3b .LBB1_3: mov eax, 3 jmp .LBB1_10 .LBB1_4: mov eax, 1 jmp .LBB1_10 .LBB1_5: mov eax, 2 jmp .LBB1_10 .LBB1_7: xor eax, eax jmp .LBB1_10 .LBB1_8: mov eax, 4 jmp .LBB1_10 .LBB1_9: mov eax, 5 .LBB1_10: sub rsp, 24 mov qword ptr [rsp + 8], rax mov qword ptr [rsp + 16], rsi lea rdi, [rsp + 8] call example::check_module_declaration::h47851d60ce069a6b add rsp, 24 .LBB1_11: ret .LJTI1_0: .long .LBB1_2-.LJTI1_0 .long .LBB1_7-.LJTI1_0 .long .LBB1_4-.LJTI1_0 .long .LBB1_5-.LJTI1_0 .long .LBB1_3-.LJTI1_0 .long .LBB1_8-.LJTI1_0 .long .LBB1_9-.LJTI1_0 .long .LBB1_2-.LJTI1_0 ``` After: ```asm example::check_after::h7e9549e143229746: lea rax, [rdi - 1] cmp rax, 6 jae .LBB0_1 sub rsp, 24 mov qword ptr [rsp + 8], rax mov qword ptr [rsp + 16], rsi lea rdi, [rsp + 8] call example::check_module_declaration::h47851d60ce069a6b add rsp, 24 .LBB0_5: ret .LBB0_1: test rdi, rdi je .LBB0_3 cmp rdi, 7 jne .LBB0_5 .LBB0_3: mov rdi, rsi jmp example::check_program::hdcbd5472c2f04f3b ```
ff2620d to
605a290
Compare
c36ee14 to
3886ddc
Compare



Replaces the match guard pattern that calls
is_module_declaration()for every AST node with thematch_module_declaration!macro for direct pattern matching.Before:
After: