iceberg-kitten opened a new pull request, #1638: URL: https://github.com/apache/arrow-go/pull/1638
### Why Casts between binary arrays and views size the output, then repeat capacity and validity checks on each builder append. ### What Write the cast result directly into Arrow buffers. ### Implementation Size the headers, offsets, and payload up front and copy the logical validity bitmap. Keep the existing UTF-8 checks and the single-buffer limit for view payloads. ### Benchmark Cast 65,536 values per operation. Values are 4 to 256 bytes, with either no nulls or a null every tenth row. | Input | Time/op before → after | Change | B/op | Allocs/op | | --- | ---: | ---: | ---: | ---: | | BinaryView → Binary, 4 B, 0% null | 2.08 → 1.11 ms | -46.5% | 827,592 → 544,843 | 78 → 54 | | BinaryView → Binary, 4 B, 10% null | 2.19 → 1.44 ms | -34.3% | 791,448 → 519,858 | 52 → 43 | | BinaryView → Binary, 32 B, 0% null | 2.51 → 1.55 ms | -38.1% | 2,659,243 → 2,378,089 | 52 → 40 | | BinaryView → Binary, 32 B, 10% null | 2.51 → 1.73 ms | -31.1% | 2,446,251 → 2,174,664 | 52 → 43 | | BinaryView → Binary, 256 B, 0% null | 5.3 → 4.09 ms | -22.7% | 17,339,311 → 17,058,171 | 52 → 40 | | BinaryView → Binary, 256 B, 10% null | 4.71 → 3.68 ms | -21.9% | 15,659,950 → 15,388,378 | 52 → 44 | | String → StringView, 8 B, 0% null | 2.29 → 1.5 ms | -34.3% | 2,126,486 → 1,059,062 | 46 → 38 | | String → StringView, 8 B, 10% null | 2.31 → 1.72 ms | -25.5% | 2,126,485 → 1,068,630 | 46 → 41 | | String → StringView, 32 B, 0% null | 3.75 → 2.22 ms | -40.7% | 4,232,004 → 3,164,564 | 52 → 42 | | String → StringView, 32 B, 10% null | 3.65 → 2.3 ms | -37.1% | 4,019,012 → 2,961,132 | 52 → 45 | | String → StringView, 256 B, 0% null | 5.07 → 4.33 ms | -14.6% | 18,912,069 → 17,844,645 | 52 → 43 | | String → StringView, 256 B, 10% null | 5.24 → 4.29 ms | -18.2% | 17,232,711 → 16,174,830 | 52 → 45 | Medians of 8 runs per revision on Linux amd64, Intel Core i9-12900HK, Go 1.26.11, pinned to one efficiency core. Baseline is `main` at `aba35416`. Use the same benchmark on both revisions. Copy the PR's benchmark file into the baseline checkout before running. ```sh go test ./arrow/compute -run '^$' -bench '^BenchmarkBinary(ToViewDirectBuffers|ViewToBinaryMaterialization)$/^((value-len|bytes)=(4|8|32|256))$/^null-every=(0|10)$' -benchmem -benchtime=120ms -count=8 -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]
