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

   **What**
   - Pre-size view metadata indexes.
   
   **Why**
   - The slice length is known. A capacity hint avoids map growth while adding 
entries.
   
   **Implementation**
   - Use `make(map[K]T, len(s))` in `indexBy`.
   - Add a focused benchmark for 1, 10, 32 and 128 entries.
   
   **Benchmark**
   Apple M1 Pro, darwin/arm64, Go 1.26.3. Median of 5 runs, 300ms each, 
`-cpu=1`. Measures the `indexBy` helper with integer keys and one-field values. 
The default view version history size is 10.
   
   | Entries | Before ns/op | After ns/op | B/op before → after | Allocs/op 
before → after |
   | --- | ---: | ---: | ---: | ---: |
   | 1 | 127.4 | 123.9 | 192 → 192 | 2 → 2 |
   | 10 | 471.6 | 319.2 | 520 → 376 | 5 → 4 |
   | 32 | 2070 | 849 | 2312 → 1240 | 9 → 4 |
   | 128 | 8150 | 3318 | 9544 → 4952 | 13 → 4 |
   
   ```sh
   go test ./view -run '^$' -bench '^BenchmarkIndexBy$' -benchmem 
-benchtime=300ms -count=5 -cpu=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