Skip to content

perf(transform): hash decimal buckets without allocating - #1817

Draft
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/decimal-bucket-hash-no-alloc
Draft

perf(transform): hash decimal buckets without allocating#1817
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:perf/decimal-bucket-hash-no-alloc

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What

  • Hash decimal bucket values directly from decimal128 signed two-complement bytes.
  • Keep DecimalLiteral.MarshalBinary unchanged.
  • Add boundary and random compatibility tests.
  • Add focused benchmarks.

Why

Decimal bucketing used to build a big.Int and an allocated byte slice for every value.

Benchmark

Apple M1 Pro, arm64. Inputs are pre-boxed:

Path Before After Result
Bucket Apply 124.9 ns, 97 B, 4 allocs 17.3 ns, 0 B, 0 allocs 7.2x faster, zero allocations
Bound Transformer 126.3 ns, 97 B, 4 allocs 13.5 ns, 0 B, 0 allocs 9.4x faster, zero allocations

Tests

  • go test ./...
  • go vet .

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