fallintoplace opened a new pull request, #1931: URL: https://github.com/apache/iceberg-go/pull/1931
## What - Avoid regexp matching in `ParseTransform`. - Dispatch common lowercase transforms directly. - Parse `bucket[...]` and `truncate[...]` with prefix, digit, and closing-bracket checks. - Keep mixed-case support and the existing unknown/error behavior. - Add edge-case coverage and a parser benchmark. ## Why `ParseTransform` used to lowercase every input and run two regexp matches before checking the six simple transforms. This adds avoidable work to a common metadata parsing path. ## Benchmark Apple M1 Pro. Median of 5 runs: ```text go test . -run '^$' -bench '^BenchmarkParseTransform$' -benchmem -count=5 -benchtime=300ms ``` | Input | Before | After | Speedup | Allocations | | --- | ---: | ---: | ---: | ---: | | `identity` | 16.2 ns/op, 0 B | 3.60 ns/op, 0 B | 4.5x | 0 -> 0 | | `day` | 11.8 ns/op, 0 B | 3.03 ns/op, 0 B | 3.9x | 0 -> 0 | | `bucket[16]` | 106 ns/op, 32 B | 14.0 ns/op, 0 B | 7.6x | 1 -> 0 | | `truncate[8]` | 126 ns/op, 32 B | 16.0 ns/op, 0 B | 7.9x | 1 -> 0 | | `BuCkEt[16]` | 146 ns/op, 48 B | 92.4 ns/op, 16 B | 1.6x | 2 -> 1 | | `custom_transform[42]` | 89.1 ns/op, 16 B | 44.1 ns/op, 16 B | 2.0x | 1 -> 1 | ## Tests - `go test . -count=1` - `go vet .` -- 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]
