Repository navigation
perf(vector): use typed views for selected fixed-width copies - #32627
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Scope and interpretationThis PR changes only the non-NULL 4/8-byte selected payload copy loop. Bulk component instruction reductions are 15.1% (4 bytes) and 19.1% (8 bytes) at 256 selected rows. The earlier dense prototype measured 28.1%/35.1% reductions for 7,782 selected rows; those are component results. Actual TPC-H gather calls average roughly 19–27 selected rows in Q5/Q15, and the loop accounts for a small fraction of each complete query. One-row controls use about 2.8%/2.3% more instructions; the requester explicitly prioritized bulk copying and accepted this tradeoff. Dense/sparse controls report 0 Go B/op and 0 allocations/op. SF100 Total +1.88% wall time is accepted by the requester as jitter. Every per-query result, including the Q16 +15.8% median, is retained below. The actual sum of retired instructions across all five complete warm SF100 suites decreases 0.207%; the sum of query-median CPU times decreases 0.28%, and warm application peak decreases 40.61 → 40.36 GiB. MethodOne local process per build/configuration, one excluded complete cold Q1–Q22 suite, then five complete warm suites with profiling/accounting. No benchmark-time row/result/checksum verification. All 32 CPUs, GOGC=100, 16 GiB CN shared cache, 48 GiB application and aggregate/join spill thresholds, 52 GiB parent limit, application swap disabled. No spill/swap/OOM in accepted measurements. Tables use per-query medians; Total sums those medians. Actual complete-suite instruction totals are reported separately. Repetitions within a process are not independent process pairs. Instruction counters cover the MO server; CPU, memory and I/O cover the application cgroup. Measured clean normal binaries: main SF10 memory
Raw slower wall medians: Q6, Q8, Q14. Initial SF10 disk; page-policy diagnostic below
Raw slower wall medians: Q1, Q2, Q5, Q6, Q7, Q8, Q10, Q11, Q13, Q16, Q17, Q18, Q20, Q21. SF100 disk, uncompressed temporary clones
Raw slower wall medians: Q1, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q19, Q20, Q21, Q22. Measurement corrections and causal controlsThe initial SF100 disk-main arm was excluded by the unchanged two-core interference guard. Btrfs Zstd I/O workers consumed CPU outside the application cgroup. Both fresh SF100 arms used uncompressed task-owned clones ( The original SF10-memory peak observer reopened memory.peak after resetting it. This kernel scopes that reset to the same open descriptor, so the old 24.17/26.40 GiB values are historical maxima. A resource-only correction retained the descriptor and measured 21.480 → 21.103 GiB warm peak. Original latency and instruction measurements were retained. The original SF10-disk Q18 median increased 0.3019 → 0.3454 s, with lower user instruction work but higher kernel CPU and more page faults/fewer huge-page allocations. A process-local control disabled transparent huge pages equally for both arms: Q18 then measured 0.3433 → 0.3336 s. Main's kernel CPU changed from 1.361 to 1.963 s in that control; no production copy code changed. This supports a page-allocation explanation for the original gap. Q8's original disk sampled non-GC cycles decreased 39.226 → 38.917 G, while GC cycles increased 3.504 → 5.707 G. Separate instruction-sampling diagnostics also found no increased Q8 foreground instruction work. SF100 Q16's median includes candidate GC in warm runs 1/4 and a page-fault burst in run 2. The full samples are:
Q16 instruction medians are 64.789 → 64.525 G (−0.41%). The final warm sample is 0.5719 → 0.5625 s. A focused cache/TLB counter diagnostic, retaining all 22 queries and equal page policy, measured approximately 0.3% fewer Q16 instructions with similar LLC/TLB miss counts; the earlier large CPU-cycle gap did not reproduce at the same amplitude. These are causal diagnostics and do not replace the original five warm latency samples. Allocation/copy accounting (separate instrumented builds)The copy/store probes include shuffle stores in both arms, so moving a loop into the helper does not manufacture byte savings. Counts describe instrumented Go sites, not all runtime/native memory traffic. Go allocation totals include Go-backed MPool allocations; MPool totals must not be added to overall Go totals. Concurrent/background activity causes small whole-query count differences; the isolated reused-vector controls allocate zero bytes/objects.
Validation: existing TestUnionFixedSelection and the owning vector package passed, including both selection index widths, exact bit patterns, NULL/grouping controls, prefixes/repeated/reordered selections, borrowed windows, source mutation and self-append growth. Targeted SIMD-mode molint passed. Full default-mode pre-push SCA passed (molint, license headers/dependencies, golangci-lint). Opt-in SIMD full SCA separately reports two unchanged vector-index unsafe imports on both clean main and this branch; this PR adds no SIMD source or build-tag changes. |
|
Queue requested — the merge queue status continues in this comment ↓. |
🛑 Queue command cancelledQueue requested — the merge queue status continues in this comment ↓. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 74661e5cf318de062681c8c6972f5264c0e42a08
Assessment: approve
Reusing the existing typed gather simplifies copying while preserving append ownership, payload bits and metadata. No actionable defects found.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Isolation preflight passed; native inputs and retained artifacts verified.
-
Full vector package passed: 397 root tests and 1,928 subtests. Focused selection coverage and four batch-consumer tests also passed.
-
Baseline/candidate benchmarks completed; all 300 samples reported zero allocations.
-
Source remained unchanged. Discussion coverage, receipts and logs reconciled in validation-audit.json.
Limitations:
-
Benchmark timings remained noisy, including unchanged controls; no general speedup or regression established.
-
Broader TPC-H and full static-suite results were assessed as supplied author reports, without independent reruns.
🛑 Pull request from fork cannot be queuedDetailsThis pull request comes from a fork, and Mergify needs the author's permission to update its branch. |
2 similar comments
🛑 Pull request from fork cannot be queuedDetailsThis pull request comes from a fork, and Mergify needs the author's permission to update its branch. |
🛑 Pull request from fork cannot be queuedDetailsThis pull request comes from a fork, and Mergify needs the author's permission to update its branch. |
❌ Left the queue · checks failed1 h 17 min in the queue, with no time running CI. So far
The failure is in this pull request. It failed tested alone on top of Reason The merge conditions cannot be satisfied due to failing checks
To get back in the queue
Merge conditions not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
Related to #32385
What this PR does / why we need it:
Use the existing typed selected-copy helper for non-NULL, nonconstant 4-byte and 8-byte payloads in vector.unionT. Establish typed source and destination views once per append, reducing repeated byte-offset arithmetic and bounds checks in bulk selections.
Copy raw uint32/uint64 payload bits while the existing append path owns alias/COW handling, capacity admission, selection order and repetitions, destination prefixes, and NULL/grouping/provenance metadata. The typed views borrow the existing backing memory and preserve floating-point and decimal bit patterns.
Add dense and sparse selection benchmarks over preallocated off-heap vectors. Reuse the existing fixed-selection correctness and ownership suite. Owning vector tests, targeted SIMD-mode checks, and the full repository default-mode pre-push static checks passed.