fallintoplace opened a new pull request, #1921: URL: https://github.com/apache/iceberg-go/pull/1921
## What changed - Reuse small stack buffers in `canonicalPartitionKey`. - Keep the existing heap fallback for wider partitions and longer keys. - Keep sorting, value normalization, and key encoding unchanged. - Add a focused benchmark and a test for the wide-partition fallback. ## Benchmark Ran on an Apple M1 Pro (`darwin/arm64`) with Go `go1.26.3`. ```text go test ./table -run '^$' -bench '^BenchmarkCanonicalPartitionKey$' -benchmem -count=5 -benchtime=1s ``` Median of 5 runs: | Case | ns/op before | ns/op after | B/op before -> after | allocs/op before -> after | | --- | ---: | ---: | ---: | ---: | | fields=1/int32 | 84.39 | 73.89 | 16 -> 8 | 2 -> 1 | | fields=2/int32 | 179.8 | 94.01 | 40 -> 16 | 3 -> 1 | | fields=4/int32 | 244.6 | 140.5 | 88 -> 32 | 4 -> 1 | | fields=8/mixed | 435.8 | 247.0 | 392 -> 80 | 7 -> 1 | | fields=4/binary-string | 254.8 | 157.2 | 184 -> 64 | 5 -> 1 | | fields=16/mixed | 782.1 | 602.8 | 792 -> 288 | 8 -> 2 | The common cases now use one allocation for the returned string. The wide case still exercises the heap fallback. ## Checks - `go test ./...` - `go vet ./...` - `go test -race ./table` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
