Skip to content

perf(internal/hashing): avoid boxing byte slices in InsertOrGet - #1310

Open
fallintoplace wants to merge 3 commits into
apache:mainfrom
fallintoplace:perf/internal-hashing-binary-memo
Open

perf(internal/hashing): avoid boxing byte slices in InsertOrGet#1310
fallintoplace wants to merge 3 commits into
apache:mainfrom
fallintoplace:perf/internal-hashing-binary-memo

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What changed

  • InsertOrGet already receives a []byte.
  • It still called getHash, which accepts interface{} and boxed the slice.
  • This now calls Hash(val, 0) directly, matching the typed hashing path.
  • There is no behavior change.

Benchmark

The focused BenchmarkBinaryMemoTableInsertOrGet exercises this exact method with 65,536 lookups over 100 repeated values.

Apple M1 Pro, Go 1.26.3:

After
ns/op 1.28 ms
B/op 0
allocs/op 0

The old Parquet byte-array benchmark was removed from this description because it uses a separate memo implementation.

Testing

  • go test ./internal/hashing
  • go test ./... with PARQUET_TEST_DATA configured

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