fallintoplace opened a new pull request, #2222: URL: https://github.com/apache/iceberg-go/pull/2222
## What - Skip UTF-8 decoding when a string already fits the truncation width. ## Why - Unchanged partition strings currently scan every rune before returning. ## Implementation - Return the input directly when `width >= len(s)`. - Add boundary coverage and a before/after benchmark. ## Benchmark Go 1.26.3, Apple M1 Pro, median of 10 samples (`-benchtime=300ms`, `-benchmem`). The benchmark compares the previous helper with the production function in the same package. - Short ASCII unchanged: 8.24 to 2.17 ns/op (3.8x faster). - 128-byte ASCII unchanged: 93.8 to 2.13 ns/op (44x faster). - Short Unicode unchanged: 16.8 to 2.13 ns/op (7.9x faster). - 128-byte Unicode unchanged: 166.7 to 2.14 ns/op (78x faster). - 128-byte Unicode truncated: 44.0 to 44.0 ns/op. - UTF-8 byte-boundary no-op: 6.44 to 6.61 ns/op (2.6% slower). -- 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]
