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

   **What**
   
   - Reduce allocations in `UpdateNameMapping`.
   
   **Why**
   
   - Renaming or adding fields copies already-cloned name lists again.
   - A 256-field rename is 42% faster and uses 49% fewer allocations.
   
   <details>
   <summary>Full benchmark results (21 cases)</summary>
   
   Apple M1 Pro, Go 1.26.3, one CPU. Medians of 7 x 1s runs with the same 
benchmark file at both revisions. Update fixtures have two aliases per field.
   
   | Case/fields | Time/op (us) before -> after | B/op before -> after | 
Allocs/op before -> after |
   |---|---:|---:|---:|
   | Apply control/256 | 55.217 -> 55.632 | 68,424 -> 68,424 | 31 -> 31 |
   | no-updates/2 | 0.613 -> 0.425 | 576 -> 384 | 12 -> 8 |
   | rename/2 | 0.700 -> 0.548 | 656 -> 448 | 13 -> 9 |
   | rename-reused/2 | 0.715 -> 0.585 | 656 -> 448 | 13 -> 9 |
   | add-reused/2 | 1.300 -> 0.949 | 1,344 -> 960 | 22 -> 14 |
   | no-updates/8 | 2.194 -> 1.615 | 2,400 -> 1,632 | 38 -> 22 |
   | rename/8 | 2.558 -> 1.767 | 2,480 -> 1,696 | 39 -> 23 |
   | rename-reused/8 | 2.406 -> 1.757 | 2,480 -> 1,696 | 39 -> 23 |
   | add-reused/8 | 4.038 -> 2.595 | 5,216 -> 3,680 | 62 -> 30 |
   | no-updates/256 | 67.758 -> 39.898 | 83,808 -> 59,232 | 1,035 -> 523 |
   | rename/256 | 73.489 -> 42.497 | 83,888 -> 59,296 | 1,036 -> 524 |
   | rename-reused/256 | 70.982 -> 42.781 | 83,888 -> 59,296 | 1,036 -> 524 |
   | add-reused/256 | 107.863 -> 63.463 | 141,152 -> 92,000 | 1,559 -> 535 |
   | no-updates/1024 | 271.601 -> 189.615 | 319,328 -> 221,024 | 4,109 -> 2,061 
|
   | rename/1024 | 274.866 -> 194.154 | 319,408 -> 221,088 | 4,110 -> 2,062 |
   | rename-reused/1024 | 244.503 -> 206.764 | 319,408 -> 221,088 | 4,110 -> 
2,062 |
   | add-reused/1024 | 412.551 -> 299.124 | 630,624 -> 434,016 | 6,172 -> 2,076 
|
   | nested/rename-reused/8 | 3.100 -> 1.924 | 2,712 -> 1,848 | 45 -> 27 |
   | nested/add-reused/8 | 4.332 -> 3.033 | 5,448 -> 3,832 | 68 -> 34 |
   | nested/rename-reused/256 | 59.864 -> 46.268 | 84,120 -> 59,448 | 1,042 -> 
528 |
   | nested/add-reused/256 | 93.554 -> 62.873 | 141,384 -> 92,152 | 1,565 -> 
539 |
   
   Every update case is faster (p <= 0.017). The unchanged Apply control has no 
significant timing change (p=0.710).
   
   Command: `go test . -run '^$' -bench 
'^Benchmark(UpdateNameMapping|ApplyNameMappingWideSchema)' -benchmem 
-benchtime=1s -count=7 -cpu=1`.
   
   Base: `0b0828bffd8ba7f50e18cbafa59d6a4b8e5df2f6`.
   Head: `a1806d32628e8c195c52c8376f5a0578941b75b6`.
   
   </details>
   
   **Implementation**
   
   - Filter the existing name copy in one pass.
   - Clear removed aliases from unused slice space.
   - Keep field order and independent input/output mappings.
   


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