fallintoplace opened a new pull request, #1361: URL: https://github.com/apache/arrow-go/pull/1361
**What** - Skip sorting when metadata keys are in the same order. **Why** - Avoid two index slice allocations. This also helps field and schema equality. | Matching keys | Before | After | Allocs before / after | | --- | ---: | ---: | ---: | | 8 entries | 142.8 ns | 35.8 ns | 2 / 0 | | 128 entries | 1.873 µs | 0.601 µs | 2 / 0 | | 16 fields, 32 entries per field | 7.733 µs | 2.691 µs | 32 / 0 | Apple M1 Pro, Go 1.26.3, `GOMAXPROCS=1`. Medians from 10 samples per revision at 500 ms, in ABBA order. Base: `c1c8ed0a`. Reversed and late-swap controls showed no significant change. The 128-entry middle-swap control was 7.4% slower due to the extra key scan. **Implementation** - Return early for empty metadata. - Check the last key before scanning keys, then compare values directly if keys match. - Keep the sorted comparison for different key orders. -- 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]
