fallintoplace opened a new pull request, #2033: URL: https://github.com/apache/iceberg-go/pull/2033
## What - Optimize `Pack` and `PackEnd` when `lookback == 1`. - Keep the existing behavior for other lookback values. - Add focused regression tests and benchmarks. ## Why The one-bin lookback case was doing avoidable queue and bin work. Reusing the active bin reduces allocations for workloads that frequently evict the previous bin. ## Implementation - Keep the fast path limited to `lookback == 1`. - Preserve exact grouping and item order for both packing directions. - Cover empty input, exact fits, evictions, oversized and zero-weight items, input immutability, and early-stop behavior. ## Benchmark Go 1.23.2, linux/amd64, AMD EPYC 9V74, `GOMAXPROCS=1`. Each case packs 4,096 `int64` items with target weight 128. Values are medians from six 200 ms samples. Lower is better. | Method | Workload | Before | After | Time | Bytes/op | Allocs/op | | --- | --- | ---: | ---: | ---: | ---: | ---: | | PackEnd, lookback 1 | One item per bin | 471.5 us | 360.5 us | -23.5% | 714,760 -> 387,240 (-45.8%) | 8,210 -> 4,116 (-49.9%) | | PackEnd, lookback 1 | Mixed weights | 385.0 us | 293.1 us | -23.9% | 518,664 -> 283,304 (-45.4%) | 7,057 -> 4,115 (-41.7%) | | PackEnd, lookback 1 | Small weights | 76.0 us | 70.9 us | -6.7% | 93,152 -> 81,552 (-12.4%) | 1,039 -> 894 (-13.9%) | | Pack, lookback 1 | One item per bin | 454.2 us | 344.8 us | -24.1% | n/a | n/a | | Pack, lookback 1 | Mixed weights | 363.5 us | 298.1 us | -18.0% | 517,144 -> 281,784 (-45.5%) | 7,057 -> 4,115 (-41.7%) | | Pack, lookback 1 | Small weights | 74.2 us | 71.4 us | -3.8% | n/a | n/a | Lookbacks 10 and 64 were also measured as controls. Timing moved from about -2.1% to +2.6%, with no allocation change. The branch is based directly on upstream commit `0c8e3498c7ca94bc00be2b89f7981619565c5b9d`. No dependencies, public APIs, table properties, or file-format definitions changed. -- 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]
