fallintoplace opened a new pull request, #1233:
URL: https://github.com/apache/arrow-go/pull/1233
### Rationale for this change
`iterateExecSpans` allocates three tracking slices before it knows whether
the
batch can be processed as one contiguous span. Most non-chunked batches do
not
need that state.
### What changes are included in this PR?
- Detect non-chunked batches that fit in one execution span.
- Return that span directly without allocating chunk iteration state.
- Keep the existing path for chunked batches and batches split by
`maxChunkSize`.
- Preserve sliced array offsets, scalar promotion, and iterator completion
behavior.
- Add focused tests and a benchmark.
### Benchmark
The benchmark covers one array, two arrays, scalar plus array, all scalars,
and
a chunked control case at lengths 1, 16, 256, and 4096.
Representative results from one run on an Apple M1 Pro with Go 1.26.3:
| Case | Before | After | Allocations |
| --- | ---: | ---: | ---: |
| Array, length 1 | 342.0 ns/op, 528 B/op | 189.0 ns/op, 304 B/op | 8 -> 5 |
| Two arrays, length 1 | 451.4 ns/op, 776 B/op | 286.6 ns/op, 528 B/op | 8
-> 5 |
| Scalar plus array, length 1 | 433.8 ns/op, 776 B/op | 260.8 ns/op, 528
B/op | 8 -> 5 |
| All scalars | 468.1 ns/op, 784 B/op | 281.4 ns/op, 528 B/op | 10 -> 7 |
| Chunked control | 356.6 ns/op, 528 B/op | 339.2 ns/op, 528 B/op | 8 -> 8 |
Command:
```bash
go test ./arrow/compute -run '^$' -bench '^BenchmarkIterateExecSpans$'
-benchmem -benchtime=100ms -count=1 -cpu=1
```
### Are these changes tested?
- `go test ./arrow/compute -count=1`
- `go test -race ./arrow/compute -count=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]