fallintoplace opened a new pull request, #1934:
URL: https://github.com/apache/iceberg-go/pull/1934

   ## Summary
   
   - **Avoid a full-string rune scan and `[]rune` allocation** when truncating 
text bounds.
   - Walk only to the requested UTF-8 rune boundary.
   - Reuse the same path for variant string lower and upper bounds.
   - Keep upper-bound carry behavior for the surrogate gap and maximal rune 
cases.
   - Clone only the small truncated lower bound so it does not retain a large 
source string. ⚡
   
   ## Benchmark
   
   Local Apple M1 Pro. `width=16`, `-benchmem`, `-benchtime=100ms`.
   
   | Path | Before | After |
   | --- | ---: | ---: |
   | `TruncateUpperBoundText`, ASCII 64 KB | ~111,008 ns/op, 262,169 B/op | ~38 
ns/op, 16 B/op |
   | `TruncateUpperBoundText`, UTF-8 64 KB | ~375,620 ns/op, 139,312 B/op | ~73 
ns/op, 32 B/op |
   | Variant string bounds, ASCII 64 KB | ~285,109 ns/op, 524,432 B/op | ~169 
ns/op, 128 B/op |
   | Variant string bounds, UTF-8 64 KB | ~624,216 ns/op, 278,721 B/op | ~236 
ns/op, 160 B/op |
   
   The benchmark also covers 32 B and 1 KB values, Unicode boundaries, 
surrogate-gap carry, maximal-rune carry, and the all-maximal case.
   
   ## Tests
   
   - `go test ./table/... -count=1`
   - `go test ./... -run "^$" -count=1`
   - `go test ./table/internal -run "^$" -bench 
"^(BenchmarkTruncateUpperBoundText|BenchmarkTruncateVariantBoundString)$" 
-benchmem -benchtime=100ms -count=1`
   


-- 
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]

Reply via email to