Skip to content

perf(hashmap): hoist canonical string key sizing - #31779

Merged
XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
aunjgr:perf/string-key-canonical-dispatch
Oct 30, 2026
Merged

XuPeng-SH merged 9 commits into
matrixorigin:mainfrom
aunjgr:perf/string-key-canonical-dispatch

Conversation

@aunjgr

@aunjgr aunjgr commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #30841; broader grouping-key/state acceptance remains open.

Full source/ELF identities, matched SQL, raw timings, profiles summary and limitations.

The performance captures pin production revision d8fa09e406; current head 12989b6117 adds only the shared reconnect-test repair, with unchanged service source/native inputs.

What this PR does / why we need it:

Choose CHAR and Unicode canonical sizing once per column during hash-key preflight. Preserve per-row NULL/GROUPING precedence, exact byte counts, overflow checks and allocation admission before the existing encoders publish keys. Accumulate non-null constant widths once alongside uniform fixed widths, and keep the existing numeric sizing shortcuts ahead of string specialization.

The encoder, PAD SPACE/Unicode equality, framed key representation and source ownership remain unchanged. No cache, iterator state, API, storage format or memory-limit setting is added. The existing nullable/grouping test now covers VARCHAR, CHAR and Unicode CHAR with a broadcast constant, checking group identities and the exact80-byte binary-collation buffer. The PAD SPACE test also verifies key framing and Unicode equality.

Validation

The shared reconnect/rollback SQL fixture waits for the parked RC snapshot to be applied before disconnecting, preserving all retry, COMMIT/DDL/DML rollback and fresh-transaction assertions. It passes on this branch in default/v1, matrixone_test, set-coverage mode (4.37s).

The full hashmap owning package and affected grouping consumers passed. The final repository pre-push gate passed after merging current authoritative main, with zero static-analysis findings. CI for the newly pushed head is pending.

Performance evidence and limits

Five qualified final-source A/A/B component triplets use identical fixtures, Go1.27.1 SIMD/v3 and production function alignment64. Ordinary CHAR preparation is5.85% faster; nullable/grouping cases are about20% faster, all-NULL10.16% faster and constant3.85% faster. Empty remains inconclusive. All cases retain0B/op and0alloc/op. Cold/first samples are excluded.

Independent32-warm-call Q11 confirmation did not reproduce its earlier slower signal:−1.07%, interval−2.52% to+0.13%. The Q18 correction preserves numeric shortcuts; its separate24-warm-call comparison estimates−0.88%, interval−1.50% to−0.25%.

The ordinary full Q1–Q22 screen retained three qualified pairs and remains observational: inspection found different make-derived release metadata in detached-main and feature-branch builds. Its Q3+3.10% follow-up is retained in the evidence. After matching release metadata and hash seed, a separate four-pair Q3 comparison estimates+0.38%, interval−0.69% to+2.04%, with no directional signal. These limited-sample diagnostics are not pooled. Q1 benefit, full matched-release/SF100/mixed-I/O acceptance and broader issue closure are not claimed. No gain elsewhere waives a confirmed regression.

Both engines use eight physical CPUs, an effective16GiB CN cache and a32GiB whole-application budget. Retained timing arms pass the original CPU/build/memory/I/O/spill/swap/OOM gates. Scripts execute and drain without input/schema/table/row/reference/result/checksum verification; profiling is separate from latency scoring.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · superseded

Commit: ed1114adde65f4ec8440f111287d6f648e113e33

Review linked issue or PR description changed before publication; a fresh contextual review is queued.

@XuPeng-SH

XuPeng-SH commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: ed1114adde65f4ec8440f111287d6f648e113e33

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: ed1114adde65f4ec8440f111287d6f648e113e33

Assessment: request_changes

The updated context leaves the existing performance-validation concern open. No new semantic defect was found.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

  • P2 pkg/common/hashmap/strhashmap.go:774: The current issue explicitly requires resolving Q11 and NULL-control slowdown signals before merging this shared-path optimization.
    Impact: Performance acceptance remains incomplete. Run an independent longer balanced baseline/candidate comparison for Q11 and the flagged NULL controls under matching resource conditions, and fix any confirmed regression. Functional CI and improvements elsewhere cannot close this requirement.
    Evidence: The updated issue 30841 body and exact-head comment 6501775817 retain Q11 +1.25% (95% interval +0.78% to +2.44%) and roughly +1% NULL-control signals. Independent confirmation attempts were interrupted and excluded. These remain unconfirmed signals, not demonstrated causal regressions.

Validation:

  • Reviewed the complete delta, current discussion, updated linked issue, and relevant encoding/allocation consumers.

  • Source/evidence audit passed: checks/1793294580183850668-4.json and source-evidence-audit.log confirm matching head/patch, clean source, and complete discussion coverage.

  • Frozen-head CI reports successful unit tests, static analysis, build, coverage, and multi-CN BVT.

Limitations:

  • No fresh Go tests or performance runs were executed.

  • Raw timing artifacts and the matched SQL workload were not supplied; performance assessment uses the frozen reports.

@aunjgr aunjgr changed the title perf(hashmap): hoist CHAR key canonicalization dispatch perf(hashmap): hoist canonical string key sizing Oct 30, 2026
@aunjgr
aunjgr requested a review from XuPeng-SH October 30, 2026 08:56
@XuPeng-SH

XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 12989b6117358a6d0c9b3eadeb27ca17ee8eea01

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: 12989b6117358a6d0c9b3eadeb27ca17ee8eea01

Assessment: approve

Sizing preserves encoding and allocation contracts. The prior Q11/NULL performance-validation concern is resolved; focused correctness and race checks passed.

Model: gpt-6-astra / xhigh

Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2

Validation:

  • Both changed hashmap tests and their subtests passed.

  • Reconnect test passed under -race, followed by four repetitions in one process.

  • Independently audited all four supplied performance CSV blocks and verified captured production code matches HEAD.

  • All five discussion entries assessed. Commands, source fingerprints, exits and retained logs reconciled in validation-reconciliation.json. Source remains unchanged.

Limitations:

  • No full-suite or performance benchmark rerun; supplied performance evidence was audited.

  • Q3's unmatched-build slowdown remains recorded; the matched-metadata/seed result is inconclusive. Broader issue #30841 acceptance remains open.

@mergify mergify Bot added the queued label Oct 30, 2026
@mergify

mergify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

1 h 32 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Fri 30 Oct, 10:35 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 12:07 · 489d182

Reason

Pull request #31779 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

@XuPeng-SH
XuPeng-SH merged commit 9323cb2 into matrixorigin:main Oct 30, 2026
26 of 28 checks passed
@mergify mergify Bot added dequeued and removed queued labels Oct 30, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants