Skip to content

Perf: cache primitive sort key in SortPreservingMerge to drop per-comparison bounds checks#23162

Merged
Dandandan merged 2 commits into
apache:mainfrom
Dandandan:perf/spm-compare-cache
Jun 25, 2026
Merged

Perf: cache primitive sort key in SortPreservingMerge to drop per-comparison bounds checks#23162
Dandandan merged 2 commits into
apache:mainfrom
Dandandan:perf/spm-compare-cache

Conversation

@Dandandan

@Dandandan Dandandan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A (performance)

Rationale for this change

Two inefficiencies in the hot path:

  1. The single-column primitive/array cursor comparison was not being inlined
    (in profiles it appeared as a separate ~21% self-time symbol), and every comparison
    bounds-checked the underlying ScalarBuffer twice.
  2. maybe_poll_stream was called on every output row, even though it is a
    no-op whenever the winner's cursor is still live (the common case).
 ┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query ┃                              HEAD ┃             perf_spm-compare-cache ┃        Change ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ Q1    │ 165.13 / 166.08 ±0.75 / 166.98 ms │  131.46 / 132.49 ±0.79 / 133.86 ms │ +1.25x faster │
│ Q2    │ 141.22 / 141.86 ±0.81 / 143.38 ms │  118.06 / 120.08 ±1.30 / 121.91 ms │ +1.18x faster │
│ Q3    │ 652.56 / 657.09 ±2.91 / 661.10 ms │  645.82 / 649.88 ±3.27 / 654.55 ms │     no change │
│ Q4    │ 195.87 / 199.80 ±6.83 / 213.43 ms │  180.22 / 183.86 ±5.04 / 193.43 ms │ +1.09x faster │
│ Q5    │ 279.14 / 279.91 ±0.50 / 280.71 ms │  260.15 / 260.70 ±0.48 / 261.54 ms │ +1.07x faster │
│ Q6    │ 292.50 / 293.43 ±0.71 / 294.56 ms │  273.28 / 274.77 ±1.66 / 277.81 ms │ +1.07x faster │
│ Q7    │ 465.87 / 467.23 ±2.01 / 471.21 ms │  445.83 / 449.21 ±3.47 / 455.33 ms │     no change │
│ Q8    │ 327.51 / 330.08 ±3.25 / 336.40 ms │  319.12 / 325.35 ±6.20 / 336.30 ms │     no change │
│ Q9    │ 342.17 / 346.17 ±2.68 / 348.71 ms │ 336.40 / 348.61 ±13.37 / 368.15 ms │     no change │
│ Q10   │ 484.08 / 486.50 ±2.53 / 490.75 ms │ 474.15 / 490.16 ±13.58 / 507.56 ms │     no change │
│ Q11   │ 244.24 / 250.98 ±8.70 / 267.17 ms │  229.07 / 237.38 ±8.10 / 249.40 ms │ +1.06x faster │
└───────┴───────────────────────────────────┴────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                     ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                     │ 3619.13ms │
│ Total Time (perf_spm-compare-cache)   │ 3472.49ms │
│ Average Time (HEAD)                   │  329.01ms │
│ Average Time (perf_spm-compare-cache) │  315.68ms │
│ Queries Faster                        │         6 │
│ Queries Slower                        │         0 │
│ Queries with No Change                │         5 │
│ Queries with Failure                  │         0 │
└───────────────────────────────────────┴───────────┘

What changes are included in this PR?

  • Inline the lightweight primitive/array cursor comparisons.
  • Skip the per-row maybe_poll_stream call unless the winner's cursor is
    actually exhausted and needs a fresh RecordBatch.
  • Cache the current (and previous) value of a primitive cursor, refreshed once
    per advance() via a new CursorValues::set_offset hook (default no-op;
    ArrayValues forwards to the inner cursor).

Are these changes tested?

Existing tests

Are there any user-facing changes?

No.

🤖 Generated with Claude Code

…parison bounds checks

The primary cost of `SortPreservingMergeStream` (the loser-tree k-way merge
behind `SortPreservingMergeExec` and `SortExec`'s streaming/spill merge) is the
per-row comparison loop, not the output `interleave`. Profiling a single
primitive sort column shows ~60% of time in the loop + cursor comparison and
only ~7% in `interleave`.

Two issues on that hot path:

1. The single-column primitive/array cursor comparison was not being inlined
   (it showed up as a separate ~21% symbol), and every comparison
   bounds-checked the underlying `ScalarBuffer` twice.
2. `maybe_poll_stream` was called on every row even though it is a no-op
   whenever the winner's cursor is still live.

Changes:

- Inline the lightweight primitive/array cursor comparisons. `RowValues` is
  left out-of-line on purpose: its variable-length byte comparison is heavy
  and force-inlining it regresses the multi-column path.
- Skip the per-row `maybe_poll_stream` call unless the winner's cursor is
  actually exhausted and needs a new `RecordBatch`.
- Cache the current (and previous) value of a primitive cursor, refreshed once
  per `advance()` via a new `CursorValues::set_offset` hook (default no-op;
  `ArrayValues` forwards to the inner cursor). The hot `compare`/`eq_to_previous`
  then read cached fields instead of indexing the buffer, so the per-comparison
  bounds checks disappear. The single remaining buffer access in `set_offset`
  is dominated by the `offset < len` guard in `advance`, so the optimizer elides
  its bounds check: the length is checked once per row, not per comparison. No
  `unsafe` is used.

Benchmarks (`sort_preserving_merge`, 3 partitions x 1M rows):
- single u64 column:       ~-15%
- multiple u64 columns:    ~-6%
- single large string col: ~-5%

Covered by the existing `sorts/` tests (merge ordering, nulls, stable sort,
round-robin tie-breaker), which also exercise the new cache invariant via a
`debug_assert!` when run with debug assertions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Jun 24, 2026
@Dandandan

Copy link
Copy Markdown
Contributor Author

run benchmarks

@Dandandan

Copy link
Copy Markdown
Contributor Author

run benchmark sort_tpch

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4790073750-659-xh5mf 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing perf/spm-compare-cache (35eb7f9) to 5d24591 (merge-base) diff using: tpch
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4790073750-657-d6hpm 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing perf/spm-compare-cache (35eb7f9) to 5d24591 (merge-base) diff using: clickbench_partitioned
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4790073750-658-h758x 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing perf/spm-compare-cache (35eb7f9) to 5d24591 (merge-base) diff using: tpcds
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark running (GKE) | trigger
Instance: c4a-highmem-16 (12 vCPU / 65 GiB) | Linux bench-c4790075992-660-kx6kb 6.12.85+ #1 SMP Mon May 11 08:17:35 UTC 2026 aarch64 GNU/Linux

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected

Comparing perf/spm-compare-cache (35eb7f9) to 5d24591 (merge-base) diff using: sort_tpch
Results will be posted here when complete


File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and perf_spm-compare-cache
--------------------
Benchmark tpch_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                           HEAD ┃         perf_spm-compare-cache ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │ 38.34 / 40.21 ±1.74 / 42.45 ms │ 38.20 / 38.92 ±1.08 / 41.04 ms │     no change │
│ QQuery 2  │ 19.43 / 19.79 ±0.50 / 20.78 ms │ 19.00 / 19.28 ±0.20 / 19.60 ms │     no change │
│ QQuery 3  │ 30.96 / 31.64 ±0.99 / 33.60 ms │ 30.64 / 32.76 ±1.19 / 34.09 ms │     no change │
│ QQuery 4  │ 17.43 / 17.93 ±0.67 / 19.24 ms │ 17.40 / 17.62 ±0.12 / 17.73 ms │     no change │
│ QQuery 5  │ 38.36 / 40.51 ±1.56 / 41.99 ms │ 37.51 / 37.89 ±0.34 / 38.35 ms │ +1.07x faster │
│ QQuery 6  │ 16.18 / 16.41 ±0.28 / 16.93 ms │ 16.25 / 16.68 ±0.41 / 17.25 ms │     no change │
│ QQuery 7  │ 44.54 / 45.76 ±1.04 / 46.92 ms │ 43.46 / 46.10 ±1.39 / 47.24 ms │     no change │
│ QQuery 8  │ 43.51 / 44.13 ±1.10 / 46.33 ms │ 42.97 / 43.88 ±1.09 / 46.03 ms │     no change │
│ QQuery 9  │ 50.47 / 50.97 ±0.35 / 51.30 ms │ 50.02 / 50.88 ±1.33 / 53.54 ms │     no change │
│ QQuery 10 │ 42.46 / 42.68 ±0.18 / 42.98 ms │ 42.58 / 43.80 ±1.10 / 45.48 ms │     no change │
│ QQuery 11 │ 13.41 / 13.81 ±0.44 / 14.65 ms │ 13.42 / 14.25 ±0.92 / 15.90 ms │     no change │
│ QQuery 12 │ 23.73 / 23.92 ±0.23 / 24.35 ms │ 24.06 / 24.40 ±0.24 / 24.67 ms │     no change │
│ QQuery 13 │ 32.51 / 34.46 ±1.64 / 36.58 ms │ 32.34 / 34.05 ±1.64 / 36.33 ms │     no change │
│ QQuery 14 │ 23.79 / 24.59 ±1.16 / 26.88 ms │ 23.78 / 24.23 ±0.45 / 24.78 ms │     no change │
│ QQuery 15 │ 31.27 / 31.45 ±0.15 / 31.68 ms │ 30.99 / 31.49 ±0.70 / 32.88 ms │     no change │
│ QQuery 16 │ 13.84 / 14.14 ±0.19 / 14.33 ms │ 13.58 / 14.01 ±0.28 / 14.42 ms │     no change │
│ QQuery 17 │ 73.08 / 74.22 ±0.93 / 75.88 ms │ 73.30 / 74.30 ±0.59 / 75.05 ms │     no change │
│ QQuery 18 │ 59.54 / 60.76 ±1.10 / 62.42 ms │ 58.43 / 59.66 ±0.90 / 60.83 ms │     no change │
│ QQuery 19 │ 33.43 / 33.61 ±0.27 / 34.13 ms │ 33.53 / 34.26 ±0.83 / 35.71 ms │     no change │
│ QQuery 20 │ 32.23 / 32.42 ±0.16 / 32.68 ms │ 32.27 / 32.49 ±0.27 / 32.92 ms │     no change │
│ QQuery 21 │ 56.31 / 57.47 ±1.07 / 58.94 ms │ 55.38 / 56.86 ±1.38 / 59.14 ms │     no change │
│ QQuery 22 │ 13.94 / 14.10 ±0.15 / 14.35 ms │ 13.87 / 14.16 ±0.17 / 14.39 ms │     no change │
└───────────┴────────────────────────────────┴────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Benchmark Summary                     ┃          ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Total Time (HEAD)                     │ 764.97ms │
│ Total Time (perf_spm-compare-cache)   │ 761.97ms │
│ Average Time (HEAD)                   │  34.77ms │
│ Average Time (perf_spm-compare-cache) │  34.63ms │
│ Queries Faster                        │        1 │
│ Queries Slower                        │        0 │
│ Queries with No Change                │       21 │
│ Queries with Failure                  │        0 │
└───────────────────────────────────────┴──────────┘

Resource Usage

tpch — base (merge-base)

Metric Value
Wall time 5.0s
Peak memory 1.2 GiB
Avg memory 503.7 MiB
CPU user 22.1s
CPU sys 1.7s
Peak spill 0 B

tpch — branch

Metric Value
Wall time 5.0s
Peak memory 1.2 GiB
Avg memory 524.1 MiB
CPU user 21.9s
CPU sys 1.6s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and perf_spm-compare-cache
--------------------
Benchmark sort_tpch1.json
--------------------
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query ┃                              HEAD ┃             perf_spm-compare-cache ┃        Change ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ Q1    │ 165.13 / 166.08 ±0.75 / 166.98 ms │  131.46 / 132.49 ±0.79 / 133.86 ms │ +1.25x faster │
│ Q2    │ 141.22 / 141.86 ±0.81 / 143.38 ms │  118.06 / 120.08 ±1.30 / 121.91 ms │ +1.18x faster │
│ Q3    │ 652.56 / 657.09 ±2.91 / 661.10 ms │  645.82 / 649.88 ±3.27 / 654.55 ms │     no change │
│ Q4    │ 195.87 / 199.80 ±6.83 / 213.43 ms │  180.22 / 183.86 ±5.04 / 193.43 ms │ +1.09x faster │
│ Q5    │ 279.14 / 279.91 ±0.50 / 280.71 ms │  260.15 / 260.70 ±0.48 / 261.54 ms │ +1.07x faster │
│ Q6    │ 292.50 / 293.43 ±0.71 / 294.56 ms │  273.28 / 274.77 ±1.66 / 277.81 ms │ +1.07x faster │
│ Q7    │ 465.87 / 467.23 ±2.01 / 471.21 ms │  445.83 / 449.21 ±3.47 / 455.33 ms │     no change │
│ Q8    │ 327.51 / 330.08 ±3.25 / 336.40 ms │  319.12 / 325.35 ±6.20 / 336.30 ms │     no change │
│ Q9    │ 342.17 / 346.17 ±2.68 / 348.71 ms │ 336.40 / 348.61 ±13.37 / 368.15 ms │     no change │
│ Q10   │ 484.08 / 486.50 ±2.53 / 490.75 ms │ 474.15 / 490.16 ±13.58 / 507.56 ms │     no change │
│ Q11   │ 244.24 / 250.98 ±8.70 / 267.17 ms │  229.07 / 237.38 ±8.10 / 249.40 ms │ +1.06x faster │
└───────┴───────────────────────────────────┴────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┓
┃ Benchmark Summary                     ┃           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━┩
│ Total Time (HEAD)                     │ 3619.13ms │
│ Total Time (perf_spm-compare-cache)   │ 3472.49ms │
│ Average Time (HEAD)                   │  329.01ms │
│ Average Time (perf_spm-compare-cache) │  315.68ms │
│ Queries Faster                        │         6 │
│ Queries Slower                        │         0 │
│ Queries with No Change                │         5 │
│ Queries with Failure                  │         0 │
└───────────────────────────────────────┴───────────┘

Resource Usage

sort_tpch — base (merge-base)

Metric Value
Wall time 20.0s
Peak memory 2.5 GiB
Avg memory 1.2 GiB
CPU user 66.6s
CPU sys 2.3s
Peak spill 0 B

sort_tpch — branch

Metric Value
Wall time 20.0s
Peak memory 2.4 GiB
Avg memory 1.0 GiB
CPU user 63.8s
CPU sys 3.1s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and perf_spm-compare-cache
--------------------
Benchmark tpcds_sf1.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                                  HEAD ┃                perf_spm-compare-cache ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 1  │           5.55 / 6.07 ±0.83 / 7.71 ms │           5.59 / 6.15 ±0.83 / 7.79 ms │     no change │
│ QQuery 2  │        80.82 / 81.15 ±0.22 / 81.41 ms │        81.13 / 81.28 ±0.16 / 81.57 ms │     no change │
│ QQuery 3  │        29.72 / 29.88 ±0.11 / 30.02 ms │        29.57 / 29.82 ±0.20 / 30.14 ms │     no change │
│ QQuery 4  │     474.54 / 479.36 ±3.14 / 483.06 ms │     474.76 / 477.54 ±2.70 / 482.58 ms │     no change │
│ QQuery 5  │        52.23 / 52.90 ±1.01 / 54.86 ms │        51.73 / 52.35 ±0.49 / 52.89 ms │     no change │
│ QQuery 6  │        36.35 / 37.30 ±0.49 / 37.72 ms │        36.49 / 36.71 ±0.21 / 37.05 ms │     no change │
│ QQuery 7  │        94.44 / 95.38 ±0.73 / 96.52 ms │        94.65 / 95.36 ±0.44 / 96.02 ms │     no change │
│ QQuery 8  │        36.54 / 37.43 ±1.48 / 40.37 ms │        36.86 / 38.50 ±2.66 / 43.79 ms │     no change │
│ QQuery 9  │        52.43 / 54.70 ±1.32 / 56.58 ms │        53.89 / 56.55 ±2.54 / 61.37 ms │     no change │
│ QQuery 10 │        63.35 / 63.69 ±0.21 / 63.93 ms │        62.93 / 63.50 ±0.39 / 64.05 ms │     no change │
│ QQuery 11 │     296.73 / 298.12 ±1.01 / 299.08 ms │     292.81 / 296.22 ±2.18 / 299.33 ms │     no change │
│ QQuery 12 │        28.31 / 28.60 ±0.37 / 29.29 ms │        28.09 / 28.72 ±0.39 / 29.28 ms │     no change │
│ QQuery 13 │     118.12 / 118.88 ±0.60 / 119.69 ms │     118.07 / 119.22 ±0.86 / 120.69 ms │     no change │
│ QQuery 14 │     414.48 / 419.12 ±5.80 / 430.21 ms │     418.03 / 421.51 ±2.76 / 425.10 ms │     no change │
│ QQuery 15 │        56.48 / 59.19 ±3.93 / 66.94 ms │        58.79 / 60.37 ±2.67 / 65.72 ms │     no change │
│ QQuery 16 │           6.87 / 6.92 ±0.06 / 7.04 ms │           6.75 / 6.87 ±0.15 / 7.17 ms │     no change │
│ QQuery 17 │        80.50 / 81.97 ±1.40 / 83.90 ms │        80.76 / 82.17 ±1.19 / 84.26 ms │     no change │
│ QQuery 18 │     123.05 / 124.66 ±1.90 / 128.36 ms │     123.28 / 125.88 ±1.88 / 128.91 ms │     no change │
│ QQuery 19 │        41.48 / 41.94 ±0.31 / 42.26 ms │        41.92 / 42.23 ±0.29 / 42.71 ms │     no change │
│ QQuery 20 │        34.72 / 35.26 ±0.51 / 36.15 ms │        35.66 / 36.46 ±1.16 / 38.75 ms │     no change │
│ QQuery 21 │        17.66 / 17.90 ±0.17 / 18.11 ms │        17.42 / 17.66 ±0.14 / 17.80 ms │     no change │
│ QQuery 22 │        62.74 / 64.49 ±2.42 / 69.21 ms │        62.74 / 64.26 ±2.32 / 68.86 ms │     no change │
│ QQuery 23 │     344.44 / 347.78 ±2.84 / 351.49 ms │     344.57 / 346.99 ±1.36 / 348.42 ms │     no change │
│ QQuery 24 │     225.52 / 227.51 ±1.68 / 230.43 ms │     226.91 / 229.42 ±2.32 / 233.37 ms │     no change │
│ QQuery 25 │     110.62 / 111.41 ±0.91 / 113.15 ms │     109.83 / 111.13 ±1.19 / 113.21 ms │     no change │
│ QQuery 26 │        57.14 / 58.44 ±1.69 / 61.77 ms │        58.15 / 59.64 ±1.82 / 63.14 ms │     no change │
│ QQuery 27 │           6.39 / 6.51 ±0.12 / 6.73 ms │           6.34 / 6.52 ±0.16 / 6.82 ms │     no change │
│ QQuery 28 │        56.11 / 60.78 ±2.49 / 63.23 ms │        61.28 / 61.95 ±0.64 / 63.02 ms │     no change │
│ QQuery 29 │       97.02 / 98.48 ±1.61 / 101.49 ms │      97.94 / 101.20 ±4.55 / 110.16 ms │     no change │
│ QQuery 30 │        32.15 / 33.23 ±1.35 / 35.81 ms │        32.48 / 33.06 ±0.34 / 33.35 ms │     no change │
│ QQuery 31 │     111.15 / 112.44 ±1.46 / 115.23 ms │     111.77 / 112.37 ±0.64 / 113.52 ms │     no change │
│ QQuery 32 │        20.80 / 21.06 ±0.20 / 21.31 ms │        20.26 / 20.52 ±0.26 / 20.99 ms │     no change │
│ QQuery 33 │        37.62 / 38.16 ±0.39 / 38.67 ms │        38.08 / 38.34 ±0.23 / 38.70 ms │     no change │
│ QQuery 34 │         9.90 / 10.80 ±1.33 / 13.43 ms │         9.71 / 10.06 ±0.33 / 10.59 ms │ +1.07x faster │
│ QQuery 35 │        71.86 / 73.93 ±2.22 / 78.19 ms │        71.95 / 72.84 ±0.95 / 74.62 ms │     no change │
│ QQuery 36 │           6.00 / 6.12 ±0.16 / 6.44 ms │           5.80 / 5.95 ±0.17 / 6.27 ms │     no change │
│ QQuery 37 │           6.99 / 7.06 ±0.05 / 7.15 ms │           6.95 / 7.04 ±0.05 / 7.11 ms │     no change │
│ QQuery 38 │        61.90 / 62.40 ±0.38 / 62.97 ms │        61.95 / 62.41 ±0.32 / 62.80 ms │     no change │
│ QQuery 39 │     438.79 / 442.63 ±4.42 / 450.97 ms │     441.22 / 447.50 ±4.89 / 455.49 ms │     no change │
│ QQuery 40 │        23.17 / 24.28 ±1.66 / 27.58 ms │        23.16 / 23.38 ±0.16 / 23.62 ms │     no change │
│ QQuery 41 │        11.42 / 11.64 ±0.19 / 11.94 ms │        11.53 / 11.64 ±0.12 / 11.87 ms │     no change │
│ QQuery 42 │        23.61 / 24.60 ±0.93 / 26.29 ms │        23.69 / 24.09 ±0.21 / 24.26 ms │     no change │
│ QQuery 43 │           4.91 / 4.98 ±0.12 / 5.22 ms │           5.03 / 5.08 ±0.09 / 5.25 ms │     no change │
│ QQuery 44 │           9.44 / 9.57 ±0.19 / 9.94 ms │           9.48 / 9.62 ±0.12 / 9.84 ms │     no change │
│ QQuery 45 │        37.88 / 38.63 ±0.54 / 39.39 ms │        38.57 / 39.06 ±0.27 / 39.32 ms │     no change │
│ QQuery 46 │        11.73 / 12.17 ±0.32 / 12.71 ms │        11.68 / 11.78 ±0.08 / 11.86 ms │     no change │
│ QQuery 47 │     222.79 / 224.29 ±0.89 / 225.35 ms │     223.13 / 227.73 ±5.47 / 238.43 ms │     no change │
│ QQuery 48 │       96.13 / 97.52 ±2.14 / 101.67 ms │       96.60 / 98.55 ±2.55 / 103.54 ms │     no change │
│ QQuery 49 │        76.52 / 76.88 ±0.34 / 77.36 ms │        76.97 / 77.59 ±0.62 / 78.42 ms │     no change │
│ QQuery 50 │        58.49 / 59.36 ±0.75 / 60.65 ms │        58.93 / 60.68 ±2.61 / 65.83 ms │     no change │
│ QQuery 51 │        92.77 / 94.27 ±1.07 / 95.53 ms │        91.55 / 94.40 ±1.67 / 96.21 ms │     no change │
│ QQuery 52 │        23.99 / 24.32 ±0.34 / 24.95 ms │        24.21 / 24.40 ±0.15 / 24.63 ms │     no change │
│ QQuery 53 │        29.77 / 30.16 ±0.23 / 30.43 ms │        29.63 / 29.93 ±0.18 / 30.21 ms │     no change │
│ QQuery 54 │        55.49 / 55.68 ±0.14 / 55.85 ms │        55.65 / 57.37 ±3.12 / 63.61 ms │     no change │
│ QQuery 55 │        23.16 / 24.82 ±2.83 / 30.47 ms │        23.58 / 23.91 ±0.38 / 24.59 ms │     no change │
│ QQuery 56 │        39.18 / 39.98 ±0.46 / 40.45 ms │        39.19 / 39.73 ±0.45 / 40.55 ms │     no change │
│ QQuery 57 │     174.79 / 176.52 ±1.77 / 178.94 ms │     175.23 / 177.08 ±2.27 / 181.54 ms │     no change │
│ QQuery 58 │     115.97 / 116.49 ±0.59 / 117.58 ms │     115.06 / 116.57 ±1.17 / 118.54 ms │     no change │
│ QQuery 59 │     117.38 / 119.53 ±2.31 / 123.44 ms │     117.29 / 118.80 ±1.90 / 122.54 ms │     no change │
│ QQuery 60 │        39.63 / 40.52 ±0.64 / 41.42 ms │        40.04 / 40.98 ±0.61 / 41.82 ms │     no change │
│ QQuery 61 │        12.37 / 12.49 ±0.14 / 12.74 ms │        12.37 / 12.56 ±0.19 / 12.90 ms │     no change │
│ QQuery 62 │        46.54 / 46.84 ±0.25 / 47.24 ms │        46.41 / 46.67 ±0.27 / 47.02 ms │     no change │
│ QQuery 63 │        29.90 / 30.03 ±0.14 / 30.31 ms │        30.61 / 32.00 ±2.43 / 36.84 ms │  1.07x slower │
│ QQuery 64 │     405.53 / 408.73 ±1.95 / 411.32 ms │     406.89 / 411.94 ±2.64 / 414.57 ms │     no change │
│ QQuery 65 │     146.29 / 149.18 ±2.03 / 152.21 ms │     145.47 / 147.98 ±2.37 / 150.85 ms │     no change │
│ QQuery 66 │        78.71 / 80.30 ±2.65 / 85.59 ms │        78.78 / 79.89 ±0.86 / 80.95 ms │     no change │
│ QQuery 67 │     234.76 / 245.20 ±9.87 / 263.04 ms │     239.13 / 241.01 ±2.52 / 245.90 ms │     no change │
│ QQuery 68 │        11.91 / 12.14 ±0.25 / 12.59 ms │        12.00 / 12.20 ±0.26 / 12.70 ms │     no change │
│ QQuery 69 │        57.49 / 57.64 ±0.13 / 57.86 ms │        58.06 / 58.55 ±0.28 / 58.90 ms │     no change │
│ QQuery 70 │     103.90 / 106.70 ±3.18 / 112.62 ms │     104.53 / 107.17 ±2.95 / 112.87 ms │     no change │
│ QQuery 71 │        35.75 / 36.41 ±0.75 / 37.79 ms │        35.74 / 36.30 ±0.45 / 37.09 ms │     no change │
│ QQuery 72 │ 2133.79 / 2165.53 ±27.51 / 2216.18 ms │ 2107.54 / 2146.17 ±22.90 / 2164.62 ms │     no change │
│ QQuery 73 │         9.71 / 10.71 ±1.63 / 13.95 ms │          9.58 / 9.88 ±0.28 / 10.38 ms │ +1.08x faster │
│ QQuery 74 │     166.41 / 169.32 ±4.09 / 177.30 ms │     167.12 / 171.31 ±7.03 / 185.31 ms │     no change │
│ QQuery 75 │     150.20 / 151.09 ±1.26 / 153.53 ms │     149.97 / 151.60 ±1.42 / 154.00 ms │     no change │
│ QQuery 76 │        35.31 / 35.50 ±0.13 / 35.70 ms │        35.76 / 38.37 ±4.55 / 47.46 ms │  1.08x slower │
│ QQuery 77 │        61.40 / 65.61 ±4.25 / 73.07 ms │        61.17 / 62.86 ±2.18 / 67.15 ms │     no change │
│ QQuery 78 │     182.97 / 189.90 ±4.08 / 193.83 ms │     184.80 / 189.98 ±5.24 / 197.71 ms │     no change │
│ QQuery 79 │        67.57 / 67.97 ±0.28 / 68.26 ms │        67.50 / 67.99 ±0.59 / 69.13 ms │     no change │
│ QQuery 80 │       98.65 / 99.92 ±0.73 / 100.70 ms │      99.04 / 102.61 ±4.17 / 110.31 ms │     no change │
│ QQuery 81 │        26.06 / 27.58 ±2.05 / 31.38 ms │        25.67 / 25.82 ±0.21 / 26.24 ms │ +1.07x faster │
│ QQuery 82 │        16.85 / 17.16 ±0.31 / 17.75 ms │        16.64 / 17.83 ±2.03 / 21.88 ms │     no change │
│ QQuery 83 │        40.70 / 41.14 ±0.47 / 41.79 ms │        40.25 / 40.96 ±0.56 / 41.84 ms │     no change │
│ QQuery 84 │        30.11 / 30.40 ±0.32 / 31.01 ms │        30.00 / 30.86 ±0.43 / 31.18 ms │     no change │
│ QQuery 85 │     106.81 / 108.30 ±1.18 / 110.34 ms │     108.23 / 109.82 ±3.01 / 115.84 ms │     no change │
│ QQuery 86 │        25.31 / 25.68 ±0.23 / 26.00 ms │        24.90 / 26.40 ±1.56 / 29.42 ms │     no change │
│ QQuery 87 │        63.16 / 63.68 ±0.84 / 65.35 ms │        62.75 / 64.08 ±1.03 / 65.29 ms │     no change │
│ QQuery 88 │        61.90 / 62.79 ±0.47 / 63.20 ms │        63.34 / 63.52 ±0.18 / 63.82 ms │     no change │
│ QQuery 89 │        35.98 / 36.88 ±0.88 / 38.50 ms │        36.36 / 36.84 ±0.38 / 37.35 ms │     no change │
│ QQuery 90 │        17.22 / 17.91 ±1.01 / 19.93 ms │        17.27 / 18.05 ±1.24 / 20.52 ms │     no change │
│ QQuery 91 │        45.94 / 46.64 ±0.38 / 47.07 ms │        46.83 / 47.55 ±0.38 / 47.96 ms │     no change │
│ QQuery 92 │        29.59 / 30.04 ±0.33 / 30.51 ms │        29.64 / 30.32 ±0.60 / 31.22 ms │     no change │
│ QQuery 93 │        50.03 / 50.94 ±0.69 / 51.75 ms │        50.00 / 51.33 ±1.00 / 53.05 ms │     no change │
│ QQuery 94 │        37.96 / 39.16 ±1.61 / 42.31 ms │        38.07 / 38.37 ±0.34 / 39.04 ms │     no change │
│ QQuery 95 │        81.11 / 82.73 ±1.69 / 85.93 ms │        82.55 / 83.61 ±1.34 / 86.22 ms │     no change │
│ QQuery 96 │        24.44 / 24.65 ±0.24 / 25.09 ms │        24.25 / 24.66 ±0.47 / 25.58 ms │     no change │
│ QQuery 97 │        46.55 / 46.80 ±0.28 / 47.29 ms │        46.85 / 47.21 ±0.38 / 47.90 ms │     no change │
│ QQuery 98 │        41.76 / 42.80 ±0.87 / 44.09 ms │        42.39 / 43.78 ±1.79 / 47.30 ms │     no change │
│ QQuery 99 │        69.47 / 72.11 ±3.21 / 78.17 ms │        70.44 / 71.42 ±1.38 / 74.16 ms │     no change │
└───────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                     ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                     │ 10268.46ms │
│ Total Time (perf_spm-compare-cache)   │ 10278.11ms │
│ Average Time (HEAD)                   │   103.72ms │
│ Average Time (perf_spm-compare-cache) │   103.82ms │
│ Queries Faster                        │          3 │
│ Queries Slower                        │          2 │
│ Queries with No Change                │         94 │
│ Queries with Failure                  │          0 │
└───────────────────────────────────────┴────────────┘

Resource Usage

tpcds — base (merge-base)

Metric Value
Wall time 55.0s
Peak memory 2.1 GiB
Avg memory 1.4 GiB
CPU user 232.6s
CPU sys 6.0s
Peak spill 0 B

tpcds — branch

Metric Value
Wall time 55.0s
Peak memory 2.1 GiB
Avg memory 1.4 GiB
CPU user 233.5s
CPU sys 5.7s
Peak spill 0 B

File an issue against this benchmark runner

@adriangbot

Copy link
Copy Markdown

🤖 Benchmark completed (GKE) | trigger

Instance: c4a-highmem-16 (12 vCPU / 65 GiB)

CPU Details (lscpu)
Architecture:                            aarch64
CPU op-mode(s):                          64-bit
Byte Order:                              Little Endian
CPU(s):                                  16
On-line CPU(s) list:                     0-15
Vendor ID:                               ARM
Model name:                              Neoverse-V2
Model:                                   1
Thread(s) per core:                      1
Core(s) per cluster:                     16
Socket(s):                               -
Cluster(s):                              1
Stepping:                                r0p1
BogoMIPS:                                2000.00
Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache:                               1 MiB (16 instances)
L1i cache:                               1 MiB (16 instances)
L2 cache:                                32 MiB (16 instances)
L3 cache:                                80 MiB (1 instance)
NUMA node(s):                            1
NUMA node0 CPU(s):                       0-15
Vulnerability Gather data sampling:      Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit:             Not affected
Vulnerability L1tf:                      Not affected
Vulnerability Mds:                       Not affected
Vulnerability Meltdown:                  Not affected
Vulnerability Mmio stale data:           Not affected
Vulnerability Reg file data sampling:    Not affected
Vulnerability Retbleed:                  Not affected
Vulnerability Spec rstack overflow:      Not affected
Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
Vulnerability Spectre v2:                Mitigation; CSV2, BHB
Vulnerability Srbds:                     Not affected
Vulnerability Tsa:                       Not affected
Vulnerability Tsx async abort:           Not affected
Vulnerability Vmscape:                   Not affected
Details

Comparing HEAD and perf_spm-compare-cache
--------------------
Benchmark clickbench_partitioned.json
--------------------
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Query     ┃                                  HEAD ┃                perf_spm-compare-cache ┃        Change ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ QQuery 0  │          1.24 / 3.93 ±5.30 / 14.54 ms │          1.22 / 3.94 ±5.36 / 14.66 ms │     no change │
│ QQuery 1  │        12.61 / 12.84 ±0.17 / 13.07 ms │        12.57 / 12.79 ±0.19 / 13.06 ms │     no change │
│ QQuery 2  │        35.84 / 36.06 ±0.19 / 36.35 ms │        35.62 / 36.04 ±0.57 / 37.09 ms │     no change │
│ QQuery 3  │        30.24 / 31.16 ±0.77 / 32.25 ms │        30.18 / 30.66 ±0.34 / 31.08 ms │     no change │
│ QQuery 4  │     225.54 / 229.39 ±3.14 / 234.65 ms │     218.20 / 224.79 ±4.94 / 233.44 ms │     no change │
│ QQuery 5  │     271.58 / 273.80 ±1.90 / 277.01 ms │     271.53 / 273.42 ±2.71 / 278.80 ms │     no change │
│ QQuery 6  │           1.25 / 1.43 ±0.23 / 1.87 ms │           1.26 / 1.42 ±0.24 / 1.89 ms │     no change │
│ QQuery 7  │        13.81 / 13.93 ±0.12 / 14.12 ms │        13.52 / 13.78 ±0.14 / 13.90 ms │     no change │
│ QQuery 8  │     320.97 / 324.72 ±2.07 / 327.10 ms │     318.86 / 323.86 ±3.86 / 330.47 ms │     no change │
│ QQuery 9  │     454.70 / 459.23 ±4.25 / 465.78 ms │     450.86 / 458.64 ±7.94 / 472.06 ms │     no change │
│ QQuery 10 │        68.51 / 69.66 ±1.04 / 71.60 ms │        67.81 / 70.39 ±3.30 / 76.67 ms │     no change │
│ QQuery 11 │        79.21 / 80.43 ±0.97 / 81.83 ms │        79.91 / 81.05 ±0.90 / 82.25 ms │     no change │
│ QQuery 12 │     266.31 / 273.35 ±6.06 / 282.81 ms │     265.03 / 268.56 ±3.47 / 274.34 ms │     no change │
│ QQuery 13 │     368.86 / 374.54 ±4.53 / 380.82 ms │    363.48 / 384.74 ±15.28 / 401.28 ms │     no change │
│ QQuery 14 │     282.53 / 284.11 ±1.71 / 287.32 ms │     281.00 / 285.80 ±4.34 / 292.66 ms │     no change │
│ QQuery 15 │     272.02 / 276.23 ±3.32 / 281.90 ms │     276.69 / 283.15 ±6.08 / 293.80 ms │     no change │
│ QQuery 16 │    605.44 / 617.46 ±10.76 / 630.45 ms │     609.70 / 613.89 ±5.89 / 625.41 ms │     no change │
│ QQuery 17 │     617.61 / 620.37 ±1.70 / 622.13 ms │     618.93 / 626.92 ±7.36 / 640.24 ms │     no change │
│ QQuery 18 │ 1235.93 / 1269.28 ±19.73 / 1291.75 ms │ 1259.31 / 1292.17 ±27.86 / 1337.88 ms │     no change │
│ QQuery 19 │       27.70 / 33.54 ±11.13 / 55.79 ms │        27.67 / 27.95 ±0.31 / 28.51 ms │ +1.20x faster │
│ QQuery 20 │    514.61 / 524.13 ±10.08 / 537.37 ms │     511.53 / 521.43 ±7.47 / 534.65 ms │     no change │
│ QQuery 21 │     514.11 / 517.35 ±3.26 / 523.35 ms │     514.01 / 523.39 ±8.25 / 536.06 ms │     no change │
│ QQuery 22 │     979.81 / 985.83 ±6.85 / 998.36 ms │     986.07 / 990.04 ±4.77 / 999.17 ms │     no change │
│ QQuery 23 │ 3023.09 / 3060.34 ±24.07 / 3093.41 ms │ 3068.79 / 3099.12 ±25.33 / 3141.14 ms │     no change │
│ QQuery 24 │        41.21 / 41.40 ±0.19 / 41.76 ms │        41.20 / 48.05 ±6.74 / 58.07 ms │  1.16x slower │
│ QQuery 25 │    111.62 / 120.51 ±11.50 / 142.36 ms │     109.56 / 110.82 ±1.02 / 112.61 ms │ +1.09x faster │
│ QQuery 26 │        41.54 / 41.89 ±0.24 / 42.29 ms │        41.53 / 43.80 ±2.87 / 48.76 ms │     no change │
│ QQuery 27 │     660.98 / 672.46 ±7.56 / 681.70 ms │    666.99 / 675.93 ±11.09 / 697.62 ms │     no change │
│ QQuery 28 │ 3036.99 / 3065.49 ±15.34 / 3081.08 ms │  3018.06 / 3030.53 ±8.25 / 3039.81 ms │     no change │
│ QQuery 29 │        40.50 / 40.68 ±0.13 / 40.87 ms │        40.07 / 40.48 ±0.35 / 40.97 ms │     no change │
│ QQuery 30 │     300.40 / 307.04 ±7.35 / 319.25 ms │    299.72 / 319.57 ±16.13 / 347.13 ms │     no change │
│ QQuery 31 │     286.82 / 298.50 ±7.90 / 310.54 ms │    280.14 / 293.13 ±12.62 / 316.14 ms │     no change │
│ QQuery 32 │    944.03 / 962.15 ±12.08 / 980.90 ms │     927.60 / 933.57 ±4.85 / 941.79 ms │     no change │
│ QQuery 33 │ 1464.00 / 1484.29 ±17.77 / 1511.27 ms │ 1444.51 / 1461.71 ±21.15 / 1502.21 ms │     no change │
│ QQuery 34 │ 1470.16 / 1496.40 ±18.08 / 1519.11 ms │ 1445.02 / 1494.97 ±31.33 / 1530.65 ms │     no change │
│ QQuery 35 │    277.52 / 302.13 ±27.66 / 353.74 ms │    273.37 / 326.52 ±45.78 / 399.44 ms │  1.08x slower │
│ QQuery 36 │        67.19 / 73.59 ±4.15 / 78.30 ms │        66.63 / 73.73 ±5.50 / 83.45 ms │     no change │
│ QQuery 37 │        35.60 / 40.27 ±3.86 / 44.63 ms │        36.19 / 43.12 ±6.36 / 53.30 ms │  1.07x slower │
│ QQuery 38 │        42.70 / 47.52 ±3.51 / 51.74 ms │        43.05 / 45.96 ±2.53 / 49.11 ms │     no change │
│ QQuery 39 │     132.39 / 140.66 ±6.32 / 148.15 ms │     139.16 / 151.97 ±7.88 / 163.36 ms │  1.08x slower │
│ QQuery 40 │        14.07 / 15.09 ±1.68 / 18.44 ms │        13.96 / 15.04 ±0.95 / 16.41 ms │     no change │
│ QQuery 41 │        13.53 / 16.59 ±3.34 / 21.75 ms │        13.67 / 16.11 ±4.09 / 24.27 ms │     no change │
│ QQuery 42 │        13.21 / 15.72 ±4.57 / 24.86 ms │        13.11 / 13.33 ±0.25 / 13.68 ms │ +1.18x faster │
└───────────┴───────────────────────────────────────┴───────────────────────────────────────┴───────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Benchmark Summary                     ┃            ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Total Time (HEAD)                     │ 19555.51ms │
│ Total Time (perf_spm-compare-cache)   │ 19586.26ms │
│ Average Time (HEAD)                   │   454.78ms │
│ Average Time (perf_spm-compare-cache) │   455.49ms │
│ Queries Faster                        │          3 │
│ Queries Slower                        │          4 │
│ Queries with No Change                │         36 │
│ Queries with Failure                  │          0 │
└───────────────────────────────────────┴────────────┘

Resource Usage

clickbench_partitioned — base (merge-base)

Metric Value
Wall time 100.0s
Peak memory 11.9 GiB
Avg memory 4.5 GiB
CPU user 1004.9s
CPU sys 68.5s
Peak spill 0 B

clickbench_partitioned — branch

Metric Value
Wall time 100.0s
Peak memory 11.8 GiB
Avg memory 4.4 GiB
CPU user 1005.2s
CPU sys 69.1s
Peak spill 0 B

File an issue against this benchmark runner

@Dandandan Dandandan marked this pull request as ready for review June 24, 2026 19:48
@Dandandan Dandandan requested a review from zhuqi-lucas June 24, 2026 19:49
@Dandandan

Copy link
Copy Markdown
Contributor Author

@zhuqi-lucas perhaps you could take a look here as well? Perf results seems pretty good!

@alamb alamb added the performance Make DataFusion faster label Jun 24, 2026

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a good change to me -- thank you @Dandandan

I also did some test coverage analysis and all the new code looks covered to me

self.rows.num_rows()
}

// NOTE: `eq`/`eq_to_previous`/`compare` are deliberately NOT `#[inline]`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is't inline advisory? If you don't want this inlined, perhaps we could make it "inline(never)"

Comment thread datafusion/physical-plan/src/sorts/cursor.rs

@zhuqi-lucas zhuqi-lucas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, cool improvement, thanks @Dandandan ! Curious — was the dominant win the bounds-check reduction, or the cache locality from caching the current/previous values into the struct?

@Dandandan

Copy link
Copy Markdown
Contributor Author
  1. bounds-checked the underlying ScalarBuffer twice.
  2. maybe_poll_stream was called on every output row, even though it is a
    no-op whenever the winner's cursor is still live (the common case).

The bounds-check reduction comes from remembering the previous version.

We can also potentially start investigating if unsafe would help here 🤔 (as a follow on PR)

Yes - I think it would probably need modifying/replacing CursorValues to be more batch-aware (instead of per row).

… RowValues

Reduce the verbosity of the comments added in this PR. No functional change.

For `RowValues`, replace the "deliberately not #[inline]" note with the measured
rationale: leaving the inline decision to the compiler is fastest — forcing
either `#[inline]` or `#[inline(never)]` regresses the multi-column merge path
(~+12% on the `multiple_u64_columns` bench for `#[inline(never)]`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Dandandan

Dandandan commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews @alamb @zhuqi-lucas! 🙏

@Dandandan Dandandan enabled auto-merge June 25, 2026 06:57
@Dandandan Dandandan added this pull request to the merge queue Jun 25, 2026
Merged via the queue into apache:main with commit 284ae30 Jun 25, 2026
38 checks passed
@Dandandan Dandandan deleted the perf/spm-compare-cache branch June 25, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Make DataFusion faster physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants