Commit 62437d8
Inline numeric fast path in array comparison loop
In compare() for Val.Arr, inline the Val.Num case directly in the
while loop to avoid the overhead of a polymorphic compare() method
call for each element. The compare() method has 5 branches (Num, Str,
Bool, Null, Arr) which may prevent JIT inlining due to code size.
For the comparison benchmark (1M-element numeric array comparison),
this avoids 1M recursive method calls with polymorphic dispatch.
A/B benchmark results (averaged across two runs with reversed order):
- comparison: -8.5% (21.7ms vs 22.6ms baseline)
- comparison2: -7.2%
- bench.02/03/04: neutral (no regression)
- Full regression suite (35 cases): all within normal range
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b6f8b6d commit 62437d8
1 file changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1449 | 1449 | | |
1450 | 1450 | | |
1451 | 1451 | | |
1452 | | - | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1453 | 1462 | | |
1454 | 1463 | | |
1455 | 1464 | | |
| |||
0 commit comments