Skip to content

perf(go): encode fixed-width collections in blocks - #403

Merged
JasonXuDeveloper merged 9 commits into
mainfrom
codex/go-fixed-collections
Nov 18, 2026
Merged

JasonXuDeveloper merged 9 commits into
mainfrom
codex/go-fixed-collections

Conversation

@JasonXuDeveloper

@JasonXuDeveloper JasonXuDeveloper commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Changes

  • Encode padded primitive pairs from one checked wire block at fixed offsets.
  • Generate fixed-stride paths for maps, sets, grids and DateTimeOffset sequences. Raw-layout fallbacks call each element codec directly.
  • Cache structural classification for composite keys and share the reader's bounded probe table. Scalar and string keys use their existing comparison loops.
  • Encode fixed map entries through their addresses. On x64 the GUID map write loop reduces ten MOVUPS instructions per entry to two and retains the stride guard.

Verification

  • SDK 11.0.100 Codegen and integration tests passed (98 and 16 tests). Regenerated the conformance fixtures and Go benchmark model.
  • Go 1.22 vet, race and purego suites and all four short fuzz targets passed.
  • The full Go suites passed on 386, Arm32 and s390x in QEMU 10.0.13 with async preemption enabled.
  • Rust's related generated fixtures passed the corpus, truncation and mutational fuzz checks.
  • The first valid x64 and Arm64 A/B showed sizable gains for padded pairs, byte grids and DateTimeOffset sequences. It also found regressions in small integer and string key checks and some x64 GUID map writes. The last two functional commits address those paths.
  • The narrow rerun and noise floor passed on x64 and Arm64. GUID map writes improved by 82–85% on the sampled x64 CPUs and 81% on Neoverse-N2. On Neoverse-N2, the eight-integer and string checks were within 2% by median.

Generated codecs use direct calls on the raw-layout fallback. The exported ReadRaw and WriteRaw helpers still accept caller-supplied callbacks, and scalar/string dispatch keeps its existing cheap type lookup. Composite key field classification is cached.

Refs #353


Generated by Codex

Convert each pair in a single checked wire block when its Go layout includes padding or needs a byte-order conversion. Keep the bulk copy on matching layouts.

Refs #353
Cache the Go key classification and reuse the seeded reader table for packed keys whose equality compares all their bytes. Keep the existing comparer for padding, floating-point members, pointers, and noncanonical representations.

Refs #353
Use the wire stride for fixed-width pairs, sets, grids, and DateTimeOffset sequences. Share primitive block copies and write the raw layout fallback with direct generated calls. Exercise the generated paths against scalar bytes and invalid values.

Refs #353
The same Go 1.26.11 test binary fails in QEMU 7.2.22 and passes repeatedly with asynchronous preemption on under 10.0.13.
Independent harness branches need history-only merges of both commits. Verify each SHA is an ancestor of the request branch before pushing.
Restore the existing scalar dispatch and text probe. Cache structural bytewise equality only for composite keys, which use the same seeded reader storage and bounded probing.

Refs #353
Walk fixed map entries by index and take their address so that encoding large keys and values avoids range-value and stack temporaries.

Refs #353
Record the measured block improvements, the address-based map encoder and the dispatch controls that protected the scalar and text paths.
@JasonXuDeveloper
JasonXuDeveloper marked this pull request as ready for review November 18, 2026 17:05
…tions

# Conflicts:
#	runtimes/go/internal/generated/shapes/nino_types.go
@JasonXuDeveloper
JasonXuDeveloper merged commit b603448 into main Nov 18, 2026
38 checks passed
@JasonXuDeveloper
JasonXuDeveloper deleted the codex/go-fixed-collections branch November 18, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant