You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Rich-T-kid (via GitHub)" <gi...@apache.org> on 2026/06/01 19:27:06 UTC
[PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Rich-T-kid opened a new pull request, #10044:
URL: https://github.com/apache/arrow-rs/pull/10044
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
-->
- Closes #10029.
[A document that provides a bit of context](https://github.com/user-attachments/files/28477762/Arrow.flight.speed.up.2.pdf)
# Rationale for this change
Compression is the most compute and memory intensive part of the arrow-ipc encoding pipeline. It runs per buffer, not per record batch. For a Flight stream of 10 batches with 5 primitive arrays each, that is 100 compression calls minimum, [more for string and struct arrays](https://arrow.apache.org/docs/format/Columnar.html#compression). Each of those calls produced an owned compressed Vec that was then copied a second
time into a flat arrow_data accumulator before being written to the output. For the uncompressed path the situation was the same: Arc-backed buffer slices that required no compression were still copied into that accumulator unnecessarily.
Separately, the original **write_message()** function flushed after every dictionary and every record batch, causing repeated small OS write calls per batch.
The goal was to eliminate both problems: stop copying buffers that do not need to be copied, and stop flushing on every message.
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
- Introduced EncodedBuffer, an enum that wraps either a raw Arc-backed Buffer for the uncompressed path or an owned Vec for the compressed path, so both can be held in a uniform collection without an extra copy into a flat accumulator
- Changed write_array_data to push EncodedBuffer segments instead of copying bytes into arrow_data
- Added write_batch_direct on IpcDataGenerator which writes the FlatBuffer metadata header first, then streams each EncodedBuffer segment directly to the writer with per-buffer alignment padding, never assembling an intermediate flat Vec for the body
- FileWriter and StreamWriter both now call **write_batch_direct()**, eliminating the flush-per-message behavior and the intermediate copy on the hot path
# Are these changes tested?
These changes are intended to be completely seamless. I didn't write new unit test for the code as nothing externally changed. all test still pass
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
If this PR claims a performance improvement, please include evidence such as benchmark results.
-->
## benchmarks
[**main** -> `cargo bench --bench ipc_writer -- "StreamWriter/write_10$" --sample-size 100`]
[**my branch** -> `cargo bench --bench ipc_writer -- "StreamWriter/write_10$" --sample-size 100` ]
<img width="1832" height="982" alt="Image 6-1-26 at 3 19 PM" src="https://github.com/user-attachments/assets/8e6253a4-8a53-4d03-bdab-d0321edc2561" />
[**main** -> `cargo bench --bench ipc_writer -- --sample-size 1000`]
[**my branch** -> `cargo bench --bench ipc_writer -- --sample-size 1000`]
<img width="1944" height="1000" alt="Image 6-1-26 at 3 20 PM" src="https://github.com/user-attachments/assets/dc8015e8-ed60-487c-aa66-06f5d35499fe" />
# Are there any user-facing changes?
no
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
If there are any breaking changes to public APIs, please call them out.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4623736500
i'm suspecting the issue has to do with
` let (client, server) = tokio::io::duplex(1024 * 1024);`
per the [docs](https://docs.rs/tokio/latest/tokio/io/fn.duplex.html) "_The max_buf_size argument is the maximum amount of bytes that can be written to a side before the write returns Poll::Pending_."
The two regression cases both involve large variable-length data where the encoded payload can exceed 1MB:
roundtrip/variable/8192x8 — 8 columns × 8192 rows ~1.96MB
roundtrip/variable/65536x1 — 65536 rows, large values buffer
This also shows up in the regression cases,
`roundtrip/variable/8192x8 1.00 1251.7±29.66µs 1798.6 MB/sec 1.53 1914.9±122.75µs 1175.7 MB/sec`
`roundtrip/variable/65536x1 1.00 1285.3±51.72µs 1750.7 MB/sec 1.49 1910.5±128.29µs 1177.8 MB/sec`
throughput falls flat.
taking a look at the other benchmark results this seems consistant,
`roundtrip/fixed/65536x8 1.00 2.2±0.03ms 1821.4 MB/sec 1.19 2.6±0.16ms 1532.6 MB/sec` throughput shrinks and as such causes more blocking to happen.
Even in the event where this isn't the reason for the slow down I think 1MB is still to small for realistic max throughput.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3336667411
##########
arrow-ipc/src/writer.rs:
##########
@@ -69,7 +69,39 @@ pub struct IpcWriteOptions {
/// How to handle updating dictionaries in IPC messages
dictionary_handling: DictionaryHandling,
}
+/// Return type for [`IpcDataGenerator::write_batch_direct`]: `(dict_sizes, batch_sizes)` where
+/// each element is `(ipc_metadata_bytes, body_bytes)`.
+///
+/// [`FileWriter`] uses these sizes to build the [`Block`] index entries required by the IPC
Review Comment:
fix linting issue here
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621830624
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621805130)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4621805130-432-xw4gv 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (04e79929305b413d35a8f1c746b10cd6c357ce41) to 97f4b14 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/97f4b1460cd32b5b8c3b91ed554238e12e3e68cf..04e79929305b413d35a8f1c746b10cd6c357ce41)
BENCH_NAME=ipc_writer
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4623347495
> 🤔 results look good, Im curious as to why two of the roundtrip benchmarks were slightly slower even thought encode() is faster across the board.
Looks like the results are reproducable -- next step would be to profile it to see if you can find the answer
I wonder if we are missing a `Vec::with_capacity` or `Vec::reserve` to avoid extra allocations / copies 🤔
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3370038125
##########
arrow-ipc/src/writer.rs:
##########
@@ -70,6 +70,49 @@ pub struct IpcWriteOptions {
dictionary_handling: DictionaryHandling,
}
+/// A single buffer segment ready to be written to the output stream.
+///
+/// For the uncompressed path the original Arc-backed [`Buffer`] is stored
+/// directly (zero copy). For the compressed path the compressed bytes are
+/// owned by a scratch `Vec<u8>`.
+enum EncodedBuffer {
Review Comment:
it may be possible to remove this. Since the two paths do not intersect.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3370040629
##########
arrow-ipc/src/writer.rs:
##########
@@ -70,6 +70,49 @@ pub struct IpcWriteOptions {
dictionary_handling: DictionaryHandling,
}
+/// A single buffer segment ready to be written to the output stream.
+///
+/// For the uncompressed path the original Arc-backed [`Buffer`] is stored
+/// directly (zero copy). For the compressed path the compressed bytes are
+/// owned by a scratch `Vec<u8>`.
+enum EncodedBuffer {
Review Comment:
Nevermind
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652652767
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652613611)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4652613611-485-hmsf5 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (70a75671080ad53dee3f167c0c27daf77d397ac7) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..70a75671080ad53dee3f167c0c27daf77d397ac7)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652851763
Nice, arrow-flight is untouched by these changes as expected. should I ping @/alamb?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4662730450
@alamb introduced the changes you mentioned. I'll open up a small PR tomorrow that refactors this file to be easier to understand. Thank you!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4627190999
the benchmarks look closer for `roundtrip/variable` on my local machine than it is when @adriangbot runs them.
<img width="1758" height="1702" alt="Image 6-4-26 at 8 42 PM" src="https://github.com/user-attachments/assets/4f8e6eca-8a8e-4424-a808-3898f6d1d468" />
its hard to verify whats causing improvements/regressions when my local benchmarks are showing different characteristics.
updated the PR, can we run the benchmarks again? If this is still causing a regression I think it makes sense to look into the arrow-flight crate.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4657008236
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4656945442)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
arrow_ipc_stream_writer/FileWriter/write_10 2.08 190.0±3.19µs ? ?/sec 1.00 91.4±0.30µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10 2.14 190.1±3.80µs ? ?/sec 1.00 89.0±0.41µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd 1.00 7.3±0.05ms ? ?/sec 1.00 7.2±0.03ms ? ?/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 30.0s |
| Peak memory | 2.0 GiB |
| Avg memory | 2.0 GiB |
| CPU user | 27.8s |
| CPU sys | 0.7s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 35.0s |
| Peak memory | 2.0 GiB |
| Avg memory | 2.0 GiB |
| CPU user | 32.0s |
| CPU sys | 0.1s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622707171
🤔 results look good, Im curious as to why two of the roundtrip benchmarks were slightly slower even thought `encode()` is faster across the board.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3378522327
##########
arrow-ipc/src/writer.rs:
##########
@@ -474,27 +523,116 @@ impl IpcDataGenerator {
write_options: &IpcWriteOptions,
compression_context: &mut CompressionContext,
) -> Result<(Vec<EncodedData>, EncodedData), ArrowError> {
+ let encoded_dictionaries = self.encode_all_dicts(
+ batch,
+ dictionary_tracker,
+ write_options,
+ compression_context,
+ )?;
+ let mut arrow_data = Vec::new();
+ let (ipc_message, _, tail_pad) = self.record_batch_to_bytes(
+ batch,
+ write_options,
+ compression_context,
+ &mut BufferSink::Write(&mut arrow_data),
+ )?;
+ arrow_data.extend_from_slice(&PADDING[..tail_pad]);
+ Ok((
+ encoded_dictionaries,
+ EncodedData {
+ ipc_message,
+ arrow_data,
+ },
+ ))
+ }
+
+ /// Encode dictionary batches for all columns in `batch`.
+ fn encode_all_dicts(
+ &self,
+ batch: &RecordBatch,
+ dictionary_tracker: &mut DictionaryTracker,
+ write_options: &IpcWriteOptions,
+ compression_context: &mut CompressionContext,
+ ) -> Result<Vec<EncodedData>, ArrowError> {
let schema = batch.schema();
let mut encoded_dictionaries = Vec::with_capacity(schema.flattened_fields().len());
-
let mut dict_id = dictionary_tracker.dict_ids.clone().into_iter();
-
for (i, field) in schema.fields().iter().enumerate() {
- let column = batch.column(i);
self.encode_dictionaries(
field,
- column,
+ batch.column(i),
&mut encoded_dictionaries,
dictionary_tracker,
write_options,
&mut dict_id,
compression_context,
)?;
}
+ Ok(encoded_dictionaries)
+ }
- let encoded_message =
- self.record_batch_to_bytes(batch, write_options, compression_context)?;
- Ok((encoded_dictionaries, encoded_message))
+ /// Write dictionary batches and the record batch directly to `writer`, skipping the
+ /// intermediate body `Vec<u8>` allocations
+ /// Returns [`IpcWriteMetadata`] with the sizes needed to build footer blocks.
+ fn write_direct<W: Write>(
Review Comment:
The fact that this is named `write_direct` makes me think that it's a variant of another method called `write()` also present in this struct, but it does not seem to be the case.
Do you see any drawbacks in calling this just `.write()`?
##########
arrow-ipc/src/writer.rs:
##########
@@ -515,22 +653,20 @@ impl IpcDataGenerator {
)
}
- /// Write a `RecordBatch` into two sets of bytes, one for the header (crate::Message) and the
- /// other for the batch's data
+ /// Encodes a `RecordBatch` into a flatbuffer IPC message and fills `sink` with the
+ /// serialised buffer data.
fn record_batch_to_bytes(
&self,
batch: &RecordBatch,
write_options: &IpcWriteOptions,
compression_context: &mut CompressionContext,
- ) -> Result<EncodedData, ArrowError> {
+ sink: &mut BufferSink<'_>,
+ ) -> Result<(Vec<u8>, usize, usize), ArrowError> {
Review Comment:
It's a bit hard to infer what are all these just from reading ath the function signature.
If you think it's not worth it to encapsulate the `(Vec<u8>, usize, usize)` return value into a struct with nice field names, I'd at least extend the doc comments of the function stating what each position in the tuple is supposed to represent.
##########
arrow-ipc/src/writer.rs:
##########
@@ -1807,7 +1930,7 @@ fn get_or_truncate_buffer(array_data: &ArrayData) -> &[u8] {
fn write_array_data(
array_data: &ArrayData,
buffers: &mut Vec<crate::Buffer>,
- arrow_data: &mut Vec<u8>,
+ sink: &mut BufferSink<'_>,
nodes: &mut Vec<crate::FieldNode>,
Review Comment:
This is looking very good!
There's one thing that might confuse readers though:
Here, we are passing these two bits:
```rust
buffers: &mut Vec<crate::Buffer>,
sink: &mut BufferSink<'_>,
```
Which at first sight, it raises some questions:
- Why do we need to pass two "buffer sinks"? isn't `buffers` already a sink for `crate::Buffer` objects?
- Why do we need to dump the buffers in two places, one for `buffer` and other for `sink`, are we unnecessarily copying data because of that?
After reading a bit more carefully, one notices that there are two kinds of buffers:
- `crate::Buffer`: an autogenerated struct from the Arrow IPC spec
- `arrow_buffer::Buffer`: The classical in-memory Arrow buffer
Maybe there's a way of making this distinction a bit clearer with some more descriptive names for `BufferSink`? like naming it `ArrowDataSink` maybe?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3381017151
##########
arrow-ipc/src/writer.rs:
##########
@@ -474,27 +523,116 @@ impl IpcDataGenerator {
write_options: &IpcWriteOptions,
compression_context: &mut CompressionContext,
) -> Result<(Vec<EncodedData>, EncodedData), ArrowError> {
+ let encoded_dictionaries = self.encode_all_dicts(
+ batch,
+ dictionary_tracker,
+ write_options,
+ compression_context,
+ )?;
+ let mut arrow_data = Vec::new();
+ let (ipc_message, _, tail_pad) = self.record_batch_to_bytes(
+ batch,
+ write_options,
+ compression_context,
+ &mut BufferSink::Write(&mut arrow_data),
+ )?;
+ arrow_data.extend_from_slice(&PADDING[..tail_pad]);
+ Ok((
+ encoded_dictionaries,
+ EncodedData {
+ ipc_message,
+ arrow_data,
+ },
+ ))
+ }
+
+ /// Encode dictionary batches for all columns in `batch`.
+ fn encode_all_dicts(
+ &self,
+ batch: &RecordBatch,
+ dictionary_tracker: &mut DictionaryTracker,
+ write_options: &IpcWriteOptions,
+ compression_context: &mut CompressionContext,
+ ) -> Result<Vec<EncodedData>, ArrowError> {
let schema = batch.schema();
let mut encoded_dictionaries = Vec::with_capacity(schema.flattened_fields().len());
-
let mut dict_id = dictionary_tracker.dict_ids.clone().into_iter();
-
for (i, field) in schema.fields().iter().enumerate() {
- let column = batch.column(i);
self.encode_dictionaries(
field,
- column,
+ batch.column(i),
&mut encoded_dictionaries,
dictionary_tracker,
write_options,
&mut dict_id,
compression_context,
)?;
}
+ Ok(encoded_dictionaries)
+ }
- let encoded_message =
- self.record_batch_to_bytes(batch, write_options, compression_context)?;
- Ok((encoded_dictionaries, encoded_message))
+ /// Write dictionary batches and the record batch directly to `writer`, skipping the
+ /// intermediate body `Vec<u8>` allocations
+ /// Returns [`IpcWriteMetadata`] with the sizes needed to build footer blocks.
+ fn write_direct<W: Write>(
Review Comment:
nope, make sense to me.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3383693873
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
+ buffer: Buffer,
+ buffers: &mut Vec<crate::Buffer>,
+ sink: &mut IpcBodySink<'_>,
+ offset: i64,
compression_codec: Option<CompressionCodec>,
compression_context: &mut CompressionContext,
alignment: u8,
) -> Result<i64, ArrowError> {
- let len: i64 = match compression_codec {
- Some(compressor) => compressor.compress_to_vec(buffer, arrow_data, compression_context)?,
+ let (encoded, len) = match compression_codec {
None => {
- arrow_data.extend_from_slice(buffer);
- buffer.len()
+ let len = buffer.len() as i64;
+ (EncodedBuffer::Raw(buffer), len)
}
- }
- .try_into()
- .map_err(|e| {
- ArrowError::InvalidArgumentError(format!("Could not convert compressed size to i64: {e}"))
- })?;
+ Some(codec) => {
+ let mut scratch = Vec::new();
Review Comment:
> This is great, updated the code to have a unified `sink.write()` call. i'm a little confused by this
>
> ```
> - offset = encode_sink_buffer(
> + offset = _buffer(
> ```
I think I was in mid-thought when I got distracted 😆
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4676142218
@JakeDern any thing you can do to make the code easier to understand and avoid copies, it would be great.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4624987135
with #10070 merged into main, we should see if the regressions are fixed.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4651953981
Replaced the (`arrow_data()`, `encoded_buffers()`, `is_direct()`) triple threaded through `write_array_data()` with a single BufferSink passed by the caller, eliminating every if is_direct { collect_encoded_buffers(...) } else { write_buffer(...) } branch that was repeated at each buffer write site. All path-specific logic is now encapsulated once in `encode_sink_buffer()`, which write_array_data calls uniformly regardless of whether the output is headed for an in-memory EncodedData or a direct stream write. About -400 LOC @gabotechs
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4653216307
I am excited by this one -- I am starting to check it out
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622923614
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622787465)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.01 271.4±1.78µs 926.3 MB/sec 1.00 267.9±0.66µs 938.6 MB/sec
encode/dict/65536x8 1.00 5.1±0.12ms 395.2 MB/sec 1.11 5.6±0.21ms 357.0 MB/sec
encode/dict/8192x1 1.04 36.4±0.04µs 896.4 MB/sec 1.00 35.0±0.03µs 932.9 MB/sec
encode/dict/8192x8 1.06 305.3±1.34µs 855.9 MB/sec 1.00 287.6±1.80µs 908.7 MB/sec
encode/fixed/65536x1 1.04 10.3±0.02µs 47.6 GB/sec 1.00 9.9±0.02µs 49.3 GB/sec
encode/fixed/65536x8 1.00 1084.9±6.70µs 3.6 GB/sec 1.01 1096.8±4.18µs 3.6 GB/sec
encode/fixed/8192x1 1.00 3.0±0.01µs 20.3 GB/sec 1.03 3.1±0.01µs 19.7 GB/sec
encode/fixed/8192x8 1.06 17.4±0.02µs 28.0 GB/sec 1.00 16.4±0.06µs 29.8 GB/sec
encode/nested/65536x1 1.29 38.5±0.19µs 31.7 GB/sec 1.00 29.8±0.58µs 41.0 GB/sec
encode/nested/65536x8 1.32 2.7±0.04ms 3.6 GB/sec 1.00 2.1±0.20ms 4.8 GB/sec
encode/nested/8192x1 1.01 5.8±0.01µs 26.2 GB/sec 1.00 5.8±0.02µs 26.4 GB/sec
encode/nested/8192x8 1.04 47.3±0.08µs 25.8 GB/sec 1.00 45.5±0.14µs 26.9 GB/sec
encode/variable/65536x1 1.63 80.5±0.47µs 27.3 GB/sec 1.00 49.3±0.34µs 44.6 GB/sec
encode/variable/65536x8 1.10 5.4±0.19ms 3.2 GB/sec 1.00 4.9±0.11ms 3.6 GB/sec
encode/variable/8192x1 1.81 10.7±0.01µs 25.7 GB/sec 1.00 5.9±0.01µs 46.6 GB/sec
encode/variable/8192x8 1.37 87.5±0.23µs 25.1 GB/sec 1.00 63.9±0.26µs 34.4 GB/sec
roundtrip/dict/65536x1 1.00 1319.9±43.70µs 190.5 MB/sec 1.00 1316.4±41.25µs 191.0 MB/sec
roundtrip/dict/65536x8 1.00 14.4±0.59ms 139.9 MB/sec 1.02 14.6±0.57ms 137.9 MB/sec
roundtrip/dict/8192x1 1.01 213.3±5.87µs 153.1 MB/sec 1.00 211.4±6.11µs 154.5 MB/sec
roundtrip/dict/8192x8 1.01 1346.6±44.16µs 194.0 MB/sec 1.00 1338.9±42.85µs 195.1 MB/sec
roundtrip/fixed/65536x1 1.00 318.9±4.39µs 1568.0 MB/sec 1.00 319.6±4.24µs 1564.8 MB/sec
roundtrip/fixed/65536x8 1.00 2.2±0.03ms 1821.4 MB/sec 1.19 2.6±0.16ms 1532.6 MB/sec
roundtrip/fixed/8192x1 1.00 93.5±1.03µs 669.7 MB/sec 1.01 94.6±1.56µs 661.8 MB/sec
roundtrip/fixed/8192x8 1.01 342.0±6.09µs 1464.3 MB/sec 1.00 338.7±4.37µs 1478.2 MB/sec
roundtrip/nested/65536x1 1.01 885.1±37.56µs 1412.4 MB/sec 1.00 879.6±39.35µs 1421.4 MB/sec
roundtrip/nested/65536x8 1.00 10.0±0.39ms 1002.2 MB/sec 1.02 10.2±0.43ms 979.4 MB/sec
roundtrip/nested/8192x1 1.01 163.0±5.56µs 960.0 MB/sec 1.00 161.1±5.13µs 971.1 MB/sec
roundtrip/nested/8192x8 1.00 927.1±39.57µs 1350.1 MB/sec 1.02 941.8±46.61µs 1329.0 MB/sec
roundtrip/variable/65536x1 1.00 1285.3±51.72µs 1750.7 MB/sec 1.49 1910.5±128.29µs 1177.8 MB/sec
roundtrip/variable/65536x8 1.00 14.8±0.74ms 1217.3 MB/sec 1.01 15.0±0.53ms 1199.3 MB/sec
roundtrip/variable/8192x1 1.00 210.4±5.49µs 1337.6 MB/sec 1.00 209.4±6.81µs 1344.0 MB/sec
roundtrip/variable/8192x8 1.00 1251.7±29.66µs 1798.6 MB/sec 1.53 1914.9±122.75µs 1175.7 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 345.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 352.2s |
| CPU sys | 71.6s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 340.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 333.1s |
| CPU sys | 84.7s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4643992120
<img width="1069" height="266" alt="Image 6-7-26 at 4 16 PM" src="https://github.com/user-attachments/assets/a6bc8263-3d96-4b41-916e-93e7d76ab07e" />
results here seem in line with [this](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621838941)
I removed any logic that was touching arrow-flights path. This PR focuses on removing intermediary buffer allocations for the `StreamWriter` and `FIleWriter`. Instead of accumulating all buffer bytes into a heap allocation before writing, buffer pointers are collected during encoding and streamed directly to the underlying writer once the FlatBuffer header is built.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4615704854
I think its worth mentioning that no dictionary optimizations were made in the PR, could make to make that a follow up ticket.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621154654
run benchmark flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621275974
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621154654)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.02 274.7±1.07µs 915.2 MB/sec 1.00 270.3±1.55µs 930.2 MB/sec
encode/dict/65536x8 1.30 5.5±0.04ms 365.9 MB/sec 1.00 4.2±0.06ms 474.4 MB/sec
encode/dict/8192x1 1.01 35.3±0.04µs 924.9 MB/sec 1.00 35.1±0.05µs 930.1 MB/sec
encode/dict/8192x8 1.10 315.3±1.66µs 828.7 MB/sec 1.00 286.1±2.01µs 913.3 MB/sec
encode/fixed/65536x1 1.00 10.0±0.02µs 48.8 GB/sec 1.00 10.0±0.04µs 49.1 GB/sec
encode/fixed/65536x8 1.01 1092.1±2.65µs 3.6 GB/sec 1.00 1076.9±5.83µs 3.6 GB/sec
encode/fixed/8192x1 1.03 3.2±0.01µs 19.3 GB/sec 1.00 3.1±0.02µs 19.8 GB/sec
encode/fixed/8192x8 1.07 17.5±0.04µs 27.9 GB/sec 1.00 16.4±0.07µs 29.8 GB/sec
encode/nested/65536x1 1.00 29.0±0.24µs 42.1 GB/sec 1.04 30.2±0.30µs 40.4 GB/sec
encode/nested/65536x8 1.12 2.5±0.08ms 3.9 GB/sec 1.00 2.2±0.13ms 4.4 GB/sec
encode/nested/8192x1 1.00 5.8±0.01µs 26.5 GB/sec 1.00 5.8±0.01µs 26.6 GB/sec
encode/nested/8192x8 1.01 46.3±0.10µs 26.4 GB/sec 1.00 45.9±0.56µs 26.6 GB/sec
encode/variable/65536x1 1.04 51.5±0.55µs 42.7 GB/sec 1.00 49.3±0.36µs 44.6 GB/sec
encode/variable/65536x8 1.24 5.7±0.09ms 3.1 GB/sec 1.00 4.6±0.06ms 3.8 GB/sec
encode/variable/8192x1 1.18 7.1±0.01µs 38.8 GB/sec 1.00 6.0±0.01µs 45.8 GB/sec
encode/variable/8192x8 1.32 83.3±1.96µs 26.4 GB/sec 1.00 63.3±0.20µs 34.7 GB/sec
roundtrip/dict/65536x1 1.01 1288.9±47.00µs 195.1 MB/sec 1.00 1279.9±51.20µs 196.4 MB/sec
roundtrip/dict/65536x8 1.00 14.4±0.55ms 139.8 MB/sec 1.01 14.5±0.53ms 138.4 MB/sec
roundtrip/dict/8192x1 1.00 206.6±5.60µs 158.1 MB/sec 1.00 206.0±5.73µs 158.6 MB/sec
roundtrip/dict/8192x8 1.00 1322.8±44.85µs 197.5 MB/sec 1.00 1324.0±44.79µs 197.3 MB/sec
roundtrip/fixed/65536x1 1.02 314.2±4.02µs 1591.6 MB/sec 1.00 307.7±4.21µs 1625.2 MB/sec
roundtrip/fixed/65536x8 1.00 2.2±0.03ms 1856.3 MB/sec 1.15 2.5±0.13ms 1608.9 MB/sec
roundtrip/fixed/8192x1 1.00 89.9±0.94µs 696.0 MB/sec 1.00 89.6±1.04µs 698.6 MB/sec
roundtrip/fixed/8192x8 1.01 333.8±3.84µs 1499.9 MB/sec 1.00 330.7±3.14µs 1514.2 MB/sec
roundtrip/nested/65536x1 1.00 859.6±40.22µs 1454.4 MB/sec 1.00 862.4±44.79µs 1449.6 MB/sec
roundtrip/nested/65536x8 1.01 8.6±0.36ms 1156.8 MB/sec 1.00 8.6±0.36ms 1168.2 MB/sec
roundtrip/nested/8192x1 1.01 159.3±5.82µs 981.9 MB/sec 1.00 157.6±5.86µs 993.0 MB/sec
roundtrip/nested/8192x8 1.02 925.9±41.73µs 1351.8 MB/sec 1.00 910.3±44.09µs 1374.9 MB/sec
roundtrip/variable/65536x1 1.00 1246.2±34.07µs 1805.6 MB/sec 1.54 1922.3±132.51µs 1170.5 MB/sec
roundtrip/variable/65536x8 1.17 16.1±0.50ms 1119.3 MB/sec 1.00 13.7±0.50ms 1313.5 MB/sec
roundtrip/variable/8192x1 1.00 204.0±5.40µs 1379.8 MB/sec 1.00 203.1±5.65µs 1385.4 MB/sec
roundtrip/variable/8192x8 1.00 1211.3±26.93µs 1858.7 MB/sec 1.57 1897.2±120.59µs 1186.7 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 345.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 350.2s |
| CPU sys | 74.8s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 335.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 335.9s |
| CPU sys | 78.4s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4628804747
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4628731195)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.00 268.7±0.46µs 935.5 MB/sec 1.00 269.2±0.76µs 934.0 MB/sec
encode/dict/65536x8 1.00 5.5±0.03ms 362.7 MB/sec 1.53 8.5±0.07ms 237.4 MB/sec
encode/dict/8192x1 1.00 35.3±0.03µs 925.3 MB/sec 1.00 35.2±0.03µs 927.1 MB/sec
encode/dict/8192x8 1.04 298.1±0.58µs 876.7 MB/sec 1.00 285.9±0.78µs 914.1 MB/sec
encode/fixed/65536x1 1.02 10.0±0.02µs 49.0 GB/sec 1.00 9.8±0.01µs 49.8 GB/sec
encode/fixed/65536x8 1.03 1130.5±2.04µs 3.5 GB/sec 1.00 1099.5±2.72µs 3.6 GB/sec
encode/fixed/8192x1 1.00 3.0±0.01µs 20.3 GB/sec 1.03 3.1±0.01µs 19.7 GB/sec
encode/fixed/8192x8 1.02 17.4±0.05µs 28.1 GB/sec 1.00 17.1±0.03µs 28.7 GB/sec
encode/nested/65536x1 1.25 38.4±0.18µs 31.8 GB/sec 1.00 30.7±0.45µs 39.7 GB/sec
encode/nested/65536x8 1.00 2.8±0.01ms 3.5 GB/sec 1.08 3.0±0.01ms 3.2 GB/sec
encode/nested/8192x1 1.00 5.8±0.01µs 26.2 GB/sec 1.00 5.8±0.01µs 26.2 GB/sec
encode/nested/8192x8 1.04 48.1±0.12µs 25.4 GB/sec 1.00 46.2±0.62µs 26.5 GB/sec
encode/variable/65536x1 1.50 73.8±0.24µs 29.8 GB/sec 1.00 49.3±0.21µs 44.6 GB/sec
encode/variable/65536x8 1.04 5.0±0.03ms 3.5 GB/sec 1.00 4.8±0.02ms 3.7 GB/sec
encode/variable/8192x1 1.19 6.9±0.01µs 39.8 GB/sec 1.00 5.8±0.01µs 47.4 GB/sec
encode/variable/8192x8 1.30 82.6±0.18µs 26.6 GB/sec 1.00 63.5±0.17µs 34.6 GB/sec
roundtrip/dict/65536x1 1.01 1292.0±46.36µs 194.6 MB/sec 1.00 1284.5±44.63µs 195.7 MB/sec
roundtrip/dict/65536x8 1.08 15.5±0.55ms 129.4 MB/sec 1.00 14.4±0.48ms 139.3 MB/sec
roundtrip/dict/8192x1 1.00 210.9±5.84µs 154.9 MB/sec 1.00 210.5±5.31µs 155.2 MB/sec
roundtrip/dict/8192x8 1.01 1346.8±45.92µs 194.0 MB/sec 1.00 1336.1±41.61µs 195.6 MB/sec
roundtrip/fixed/65536x1 1.00 315.5±4.56µs 1585.0 MB/sec 1.00 316.1±4.30µs 1581.9 MB/sec
roundtrip/fixed/65536x8 1.00 2.2±0.03ms 1815.6 MB/sec 1.37 3.0±0.22ms 1326.9 MB/sec
roundtrip/fixed/8192x1 1.00 94.9±0.97µs 659.8 MB/sec 1.00 95.0±1.18µs 659.1 MB/sec
roundtrip/fixed/8192x8 1.00 333.9±3.94µs 1499.6 MB/sec 1.00 333.1±3.84µs 1503.1 MB/sec
roundtrip/nested/65536x1 1.01 859.2±44.16µs 1455.0 MB/sec 1.00 848.1±41.92µs 1474.1 MB/sec
roundtrip/nested/65536x8 1.00 9.5±0.61ms 1055.8 MB/sec 1.06 10.0±0.59ms 997.1 MB/sec
roundtrip/nested/8192x1 1.02 163.5±5.51µs 956.8 MB/sec 1.00 160.6±5.81µs 974.2 MB/sec
roundtrip/nested/8192x8 1.00 908.7±42.46µs 1377.3 MB/sec 1.00 906.2±42.33µs 1381.2 MB/sec
roundtrip/variable/65536x1 1.00 1243.2±34.18µs 1810.0 MB/sec 1.52 1888.0±110.52µs 1191.8 MB/sec
roundtrip/variable/65536x8 1.05 16.9±0.65ms 1064.7 MB/sec 1.00 16.1±0.55ms 1117.4 MB/sec
roundtrip/variable/8192x1 1.01 209.6±5.84µs 1342.8 MB/sec 1.00 207.1±6.04µs 1358.7 MB/sec
roundtrip/variable/8192x8 1.00 1240.0±26.08µs 1815.6 MB/sec 1.42 1762.6±112.62µs 1277.3 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 340.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 340.0s |
| CPU sys | 76.8s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 330.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 319.2s |
| CPU sys | 86.0s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4645915589
run benchmarks flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4646001170
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4645915589)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.00 269.0±1.27µs 934.5 MB/sec 1.05 282.8±1.13µs 889.2 MB/sec
encode/dict/65536x8 1.00 4.0±0.03ms 499.8 MB/sec 1.43 5.7±0.03ms 350.5 MB/sec
encode/dict/8192x1 1.00 35.5±0.43µs 920.9 MB/sec 1.03 36.6±0.04µs 891.5 MB/sec
encode/dict/8192x8 1.01 306.2±4.60µs 853.4 MB/sec 1.00 301.9±2.32µs 865.4 MB/sec
encode/fixed/65536x1 1.00 9.9±0.02µs 49.5 GB/sec 1.03 10.1±0.02µs 48.3 GB/sec
encode/fixed/65536x8 1.03 1121.5±1.42µs 3.5 GB/sec 1.00 1087.5±2.55µs 3.6 GB/sec
encode/fixed/8192x1 1.00 3.2±0.01µs 19.3 GB/sec 1.00 3.2±0.01µs 19.4 GB/sec
encode/fixed/8192x8 1.00 17.6±0.03µs 27.7 GB/sec 1.01 17.8±0.05µs 27.5 GB/sec
encode/nested/65536x1 1.00 37.5±0.19µs 32.6 GB/sec 1.15 42.9±0.36µs 28.4 GB/sec
encode/nested/65536x8 1.15 3.0±0.01ms 3.3 GB/sec 1.00 2.6±0.01ms 3.8 GB/sec
encode/nested/8192x1 1.00 5.8±0.01µs 26.4 GB/sec 1.02 5.9±0.01µs 26.0 GB/sec
encode/nested/8192x8 1.00 46.5±0.08µs 26.3 GB/sec 1.05 49.1±0.13µs 24.9 GB/sec
encode/variable/65536x1 1.00 72.7±0.39µs 30.2 GB/sec 1.12 81.5±0.33µs 27.0 GB/sec
encode/variable/65536x8 1.00 5.0±0.03ms 3.5 GB/sec 1.12 5.6±0.05ms 3.1 GB/sec
encode/variable/8192x1 1.00 6.8±0.02µs 40.5 GB/sec 1.03 7.0±0.01µs 39.1 GB/sec
encode/variable/8192x8 1.00 80.9±0.16µs 27.2 GB/sec 1.02 82.7±0.21µs 26.6 GB/sec
roundtrip/dict/65536x1 1.00 1281.9±43.73µs 196.1 MB/sec 1.01 1300.0±43.37µs 193.4 MB/sec
roundtrip/dict/65536x8 1.02 14.7±0.61ms 137.1 MB/sec 1.00 14.3±0.60ms 140.4 MB/sec
roundtrip/dict/8192x1 1.00 204.0±5.97µs 160.1 MB/sec 1.03 209.5±5.67µs 155.9 MB/sec
roundtrip/dict/8192x8 1.00 1333.1±41.92µs 196.0 MB/sec 1.01 1350.3±43.61µs 193.5 MB/sec
roundtrip/fixed/65536x1 1.00 311.1±3.95µs 1607.4 MB/sec 1.01 315.5±3.73µs 1585.1 MB/sec
roundtrip/fixed/65536x8 1.00 2.1±0.02ms 1873.4 MB/sec 1.01 2.1±0.03ms 1861.8 MB/sec
roundtrip/fixed/8192x1 1.00 91.2±1.40µs 686.4 MB/sec 1.00 91.4±0.86µs 684.5 MB/sec
roundtrip/fixed/8192x8 1.00 328.6±4.67µs 1524.1 MB/sec 1.02 336.4±3.39µs 1488.6 MB/sec
roundtrip/nested/65536x1 1.00 849.6±40.97µs 1471.5 MB/sec 1.01 857.6±41.57µs 1457.7 MB/sec
roundtrip/nested/65536x8 1.00 8.3±0.34ms 1200.9 MB/sec 1.16 9.7±0.36ms 1034.4 MB/sec
roundtrip/nested/8192x1 1.00 158.6±5.50µs 986.4 MB/sec 1.01 159.9±5.60µs 978.3 MB/sec
roundtrip/nested/8192x8 1.00 904.4±45.78µs 1383.9 MB/sec 1.00 904.4±43.74µs 1383.9 MB/sec
roundtrip/variable/65536x1 1.00 1212.7±41.75µs 1855.5 MB/sec 1.01 1224.4±31.76µs 1837.8 MB/sec
roundtrip/variable/65536x8 1.00 16.1±0.50ms 1120.5 MB/sec 1.02 16.3±0.57ms 1101.1 MB/sec
roundtrip/variable/8192x1 1.00 204.7±5.69µs 1374.6 MB/sec 1.02 209.1±5.61µs 1345.9 MB/sec
roundtrip/variable/8192x8 1.00 1211.3±21.91µs 1858.7 MB/sec 1.01 1219.1±27.99µs 1846.7 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 335.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 348.5s |
| CPU sys | 65.9s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 340.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 346.0s |
| CPU sys | 71.2s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4656984141
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4656945442)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4656945442-501-9447r 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (70a75671080ad53dee3f167c0c27daf77d397ac7) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..70a75671080ad53dee3f167c0c27daf77d397ac7)
BENCH_NAME=ipc_writer
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3382685432
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
+ buffer: Buffer,
+ buffers: &mut Vec<crate::Buffer>,
+ sink: &mut IpcBodySink<'_>,
+ offset: i64,
compression_codec: Option<CompressionCodec>,
compression_context: &mut CompressionContext,
alignment: u8,
) -> Result<i64, ArrowError> {
- let len: i64 = match compression_codec {
- Some(compressor) => compressor.compress_to_vec(buffer, arrow_data, compression_context)?,
+ let (encoded, len) = match compression_codec {
None => {
- arrow_data.extend_from_slice(buffer);
- buffer.len()
+ let len = buffer.len() as i64;
+ (EncodedBuffer::Raw(buffer), len)
}
- }
- .try_into()
- .map_err(|e| {
- ArrowError::InvalidArgumentError(format!("Could not convert compressed size to i64: {e}"))
- })?;
+ Some(codec) => {
+ let mut scratch = Vec::new();
Review Comment:
This is great, updated the code to have a unified `sink.write()` call. i'm a little confused by this
```
- offset = encode_sink_buffer(
+ offset = _buffer(
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621805130
run benchmarks ipc_writer
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4628731195
run benchmarks flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652757998
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652613611)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.00 285.2±1.80µs 881.4 MB/sec 1.00 285.3±1.50µs 881.1 MB/sec
encode/dict/65536x8 1.34 9.6±0.14ms 209.0 MB/sec 1.00 7.2±0.15ms 280.1 MB/sec
encode/dict/8192x1 1.05 37.1±0.06µs 881.5 MB/sec 1.00 35.2±0.11µs 926.7 MB/sec
encode/dict/8192x8 1.00 305.6±1.28µs 854.9 MB/sec 1.03 315.1±1.20µs 829.1 MB/sec
encode/fixed/65536x1 1.01 10.4±0.04µs 47.1 GB/sec 1.00 10.2±0.01µs 47.8 GB/sec
encode/fixed/65536x8 1.00 1085.1±7.18µs 3.6 GB/sec 1.03 1112.7±9.29µs 3.5 GB/sec
encode/fixed/8192x1 1.00 3.0±0.01µs 20.1 GB/sec 1.06 3.2±0.01µs 18.9 GB/sec
encode/fixed/8192x8 1.02 17.8±0.04µs 27.5 GB/sec 1.00 17.5±0.03µs 28.0 GB/sec
encode/nested/65536x1 1.35 38.4±0.26µs 31.8 GB/sec 1.00 28.5±0.18µs 42.8 GB/sec
encode/nested/65536x8 1.00 3.1±0.09ms 3.1 GB/sec 1.03 3.2±0.08ms 3.0 GB/sec
encode/nested/8192x1 1.01 5.8±0.01µs 26.2 GB/sec 1.00 5.8±0.01µs 26.5 GB/sec
encode/nested/8192x8 1.00 45.8±0.19µs 26.7 GB/sec 1.05 48.1±0.14µs 25.4 GB/sec
encode/variable/65536x1 1.00 62.9±0.37µs 35.0 GB/sec 1.11 69.6±0.43µs 31.6 GB/sec
encode/variable/65536x8 1.00 5.7±0.24ms 3.1 GB/sec 1.03 5.9±0.16ms 3.0 GB/sec
encode/variable/8192x1 1.00 7.1±0.01µs 38.4 GB/sec 1.00 7.1±0.02µs 38.5 GB/sec
encode/variable/8192x8 1.00 79.7±0.58µs 27.6 GB/sec 1.00 79.6±0.26µs 27.6 GB/sec
roundtrip/dict/65536x1 1.01 1319.3±49.97µs 190.6 MB/sec 1.00 1311.8±42.32µs 191.7 MB/sec
roundtrip/dict/65536x8 1.00 15.0±0.58ms 134.3 MB/sec 1.07 16.0±0.67ms 125.9 MB/sec
roundtrip/dict/8192x1 1.00 207.5±5.56µs 157.4 MB/sec 1.00 208.5±5.51µs 156.7 MB/sec
roundtrip/dict/8192x8 1.00 1346.9±43.49µs 194.0 MB/sec 1.00 1345.0±45.04µs 194.3 MB/sec
roundtrip/fixed/65536x1 1.00 305.0±4.83µs 1639.8 MB/sec 1.03 314.3±3.73µs 1591.2 MB/sec
roundtrip/fixed/65536x8 1.00 2.2±0.04ms 1791.3 MB/sec 1.00 2.2±0.05ms 1799.0 MB/sec
roundtrip/fixed/8192x1 1.00 90.4±1.16µs 692.6 MB/sec 1.01 91.7±1.52µs 682.7 MB/sec
roundtrip/fixed/8192x8 1.01 329.1±3.56µs 1521.5 MB/sec 1.00 327.4±4.78µs 1529.3 MB/sec
roundtrip/nested/65536x1 1.00 871.2±51.26µs 1435.0 MB/sec 1.00 868.4±50.87µs 1439.7 MB/sec
roundtrip/nested/65536x8 1.00 10.1±0.67ms 992.0 MB/sec 1.05 10.6±0.49ms 946.4 MB/sec
roundtrip/nested/8192x1 1.00 158.4±5.60µs 987.7 MB/sec 1.00 158.5±5.00µs 987.2 MB/sec
roundtrip/nested/8192x8 1.00 916.8±42.83µs 1365.2 MB/sec 1.00 915.9±45.38µs 1366.6 MB/sec
roundtrip/variable/65536x1 1.00 1247.8±36.58µs 1803.3 MB/sec 1.05 1304.0±100.89µs 1725.6 MB/sec
roundtrip/variable/65536x8 1.00 16.5±0.56ms 1092.2 MB/sec 1.04 17.1±0.62ms 1051.2 MB/sec
roundtrip/variable/8192x1 1.00 206.9±6.52µs 1360.3 MB/sec 1.01 209.6±6.14µs 1342.6 MB/sec
roundtrip/variable/8192x8 1.00 1237.0±25.68µs 1820.1 MB/sec 1.00 1241.4±39.06µs 1813.6 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 345.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 348.1s |
| CPU sys | 76.0s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 335.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 339.6s |
| CPU sys | 73.9s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4656945442
run benchmarks ipc_writer
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid some copies in Arrow IPC [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3381083168
##########
arrow-ipc/src/writer.rs:
##########
@@ -1807,7 +1930,7 @@ fn get_or_truncate_buffer(array_data: &ArrayData) -> &[u8] {
fn write_array_data(
array_data: &ArrayData,
buffers: &mut Vec<crate::Buffer>,
- arrow_data: &mut Vec<u8>,
+ sink: &mut BufferSink<'_>,
nodes: &mut Vec<crate::FieldNode>,
Review Comment:
this makes sense to me, I've renamed it to `IpcBodySink` to help new readers understand the distinction better.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4676145063
A good first step might be to extend the benchmarks to include dictionary
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622818559
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622787465)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4622787465-441-9sh6d 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (04e79929305b413d35a8f1c746b10cd6c357ce41) to 97f4b14 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/97f4b1460cd32b5b8c3b91ed554238e12e3e68cf..04e79929305b413d35a8f1c746b10cd6c357ce41)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4622787465
run benchmark flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4676024515
@JakeDern please feel free! Im going to be looking into arrow-flight specifically so i wont have time to look at dictionary optimization at the moment. feel free to tag me in the issue & if I get a chance ill try to help out 🚀
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3341395598
##########
arrow-ipc/src/writer.rs:
##########
@@ -2111,33 +2294,33 @@ fn write_array_data(
/// follows is not compressed, which can be useful for cases where
/// compression does not yield appreciable savings.
fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+ buffer: Buffer, // input array buffer to encode
+ buffers: &mut Vec<crate::Buffer>, // IPC buffer metadata (offset + length) for the FlatBuffer message
+ encoded_buffers: &mut Vec<EncodedBuffer>, // accumulated encoded segments, written to output after the message header
+ offset: i64, // current output stream offset
compression_codec: Option<CompressionCodec>,
Review Comment:
I see this function is no longer writing the buffers, instead of writing them, it's collecting them into `encoded_buffers`. Given this new scenario, I think we need to do two things:
1. change the name of this function to something like `collect_encoded_buffers`
2. Update the doc comment, which still mentions writing to `arrow_data`
##########
arrow-ipc/src/writer.rs:
##########
@@ -1165,24 +1364,24 @@ impl<W: Write> FileWriter<W> {
));
}
- let (encoded_dictionaries, encoded_message) = self.data_gen.encode(
+ let (dict_sizes, (meta, data)) = self.data_gen.write_batch_direct(
Review Comment:
The two last `(meta, data)` fields returned by `write_batch_direct` are named (aligned_size, body_len) in that function.
Is this correct? not sure if this is just a naming thing, but it's hard to know if this is correct given the different naming. Is `meta == aligned_size` and `data == body_len`? they sound like completely different things.
##########
arrow-ipc/src/writer.rs:
##########
@@ -69,7 +69,39 @@ pub struct IpcWriteOptions {
/// How to handle updating dictionaries in IPC messages
dictionary_handling: DictionaryHandling,
}
+/// Return type for [`IpcDataGenerator::write_batch_direct`]: `(dict_sizes, batch_sizes)` where
+/// each element is `(ipc_metadata_bytes, body_bytes)`.
+///
+/// [`FileWriter`] uses these sizes to build the Block index entries required by the IPC
+/// footer for random-access reads.
+type IPCMetadata = Result<(Vec<(usize, usize)>, (usize, usize)), ArrowError>;
Review Comment:
It's pretty hard to know what's all of this without a proper structure with proper fields. How about having a proper struct for this?
For example:
```rust
struct IPCMetadata {
dict_sizes: Vec<(usize, usize)>,
aligned_size: usize,
body_len: usize,
}
```
Maybe there are better names for the different fields
##########
arrow-ipc/src/writer.rs:
##########
@@ -693,19 +734,177 @@ impl IpcDataGenerator {
let mut message_builder = crate::MessageBuilder::new(&mut fbb);
message_builder.add_version(write_options.metadata_version);
message_builder.add_header_type(crate::MessageHeader::DictionaryBatch);
- message_builder.add_bodyLength(arrow_data.len() as i64);
+ message_builder.add_bodyLength(body_len as i64);
message_builder.add_header(root);
message_builder.finish()
};
fbb.finish(root, None);
let finished_data = fbb.finished_data();
+ let mut arrow_data: Vec<u8> = Vec::with_capacity(body_len);
+ for encoded in &encoded_buffers {
+ arrow_data.extend_from_slice(encoded.as_slice());
+ arrow_data.extend_from_slice(
+ &PADDING[..pad_to_alignment(write_options.alignment, encoded.len())],
+ );
+ }
+ arrow_data.extend_from_slice(&PADDING[..tail_pad]);
+
Ok(EncodedData {
ipc_message: finished_data.to_vec(),
arrow_data,
})
}
+
+ /// Write dictionaries and record batch's directly to `writer`, skipping the
+ /// intermediate `arrow_data: Vec<u8>` accumulator used by [`Self::record_batch_to_bytes`].
+ ///
+ /// For the uncompressed path each array buffer is held as an Arc-backed slice and
+ /// written straight to `writer`. one copy instead of two. For the compressed path
+ /// each buffer is compressed into a per-buffer scratch `Vec<u8>` and written from
+ /// there, eliminating the extra copy that `write_buffer` -> `arrow_data` ->
+ /// `write_body_buffers` would otherwise incur.
+ fn write_batch_direct<W: Write>(
Review Comment:
I see most contents of this function are essentially copy-pastes from `record_batch_to_bytes`, duplication seems too much here. Is there any chance to:
- Completely replace `record_batch_to_bytes` and keep just a single function for writing batches in IPC format
- Factoring out some ergonomic helpers that could be reused in both functions?
Also, it seems like the `.encode()` method and the new `.write_batch_direct()` are both doing the same thing with slightly different ergonomics. Do you see any opportunity to collapse them into just 1 method?
This file is overall pretty bloated with complex logic and a relatively arbitrary separation of concerns between methods, the more we can do for debloating it the better it will be for future maintainers.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4615233666
### Benchmark results from #10031
<img width="2190" height="1504" alt="Image 6-3-26 at 1 49 PM" src="https://github.com/user-attachments/assets/27b554bf-b04c-4b78-922c-0d2f7d06b6b7" />
<img width="1556" height="1426" alt="Image 6-3-26 at 1 49 PM" src="https://github.com/user-attachments/assets/4ab74d24-09d4-46e9-8649-87e8fd9db7c0" />
<img width="1610" height="1414" alt="Image 6-3-26 at 1 49 PM (1)" src="https://github.com/user-attachments/assets/1dcacb63-44ae-437f-9f64-4bb53b780e0b" />
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4615250438
going to look into why `fixed/9182x1` regressed. Might just be noise
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "JakeDern (via GitHub)" <gi...@apache.org>.
JakeDern commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4675826329
> I think its worth mentioning that no dictionary optimizations were made in the PR, could make to make that a follow up ticket.
Looks like I'm a little late to the IPC writer performance party! I was just profiling this yesterday and then I stumbled on this PR today. Awesome stuff, this will really help us over in otel-arrow.
@Rich-T-kid I'm motivated to leverage this optimization for dictionaries and can open an issue + push that forward if you're not already looking at it. Let me know what you think
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4625207879
run benchmarks flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4628746751
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4628731195)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4628731195-448-n8w99 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (86f4e343db910b48eae2ec213836bf9ae593260a) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..86f4e343db910b48eae2ec213836bf9ae593260a)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4663815058
run benchmarks ipc_writer
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3381759987
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
Review Comment:
similarly to @gabotechs above I found the relationship between `buffer`, `buffers` and `sink` confusing.
Could you perhaps (can be a follow on PR) to add documentation here explaining what this is doing -- specifically that the `IpcBodySink` is used for the actual arrow data and the `buffers` is an in-progresss list what will eventually become the IPC metadata
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
+ buffer: Buffer,
+ buffers: &mut Vec<crate::Buffer>,
+ sink: &mut IpcBodySink<'_>,
+ offset: i64,
compression_codec: Option<CompressionCodec>,
compression_context: &mut CompressionContext,
alignment: u8,
) -> Result<i64, ArrowError> {
- let len: i64 = match compression_codec {
- Some(compressor) => compressor.compress_to_vec(buffer, arrow_data, compression_context)?,
+ let (encoded, len) = match compression_codec {
None => {
- arrow_data.extend_from_slice(buffer);
- buffer.len()
+ let len = buffer.len() as i64;
+ (EncodedBuffer::Raw(buffer), len)
}
- }
- .try_into()
- .map_err(|e| {
- ArrowError::InvalidArgumentError(format!("Could not convert compressed size to i64: {e}"))
- })?;
+ Some(codec) => {
+ let mut scratch = Vec::new();
Review Comment:
I think you could avoid this new allocation (and then copy below) if you write directly into arrow_data.
I started playing around with this locally. et me kmow what you think
```diff
diff --git a/arrow-ipc/src/writer.rs b/arrow-ipc/src/writer.rs
index 0f69fec5ba4..d94d528aeaa 100644
--- a/arrow-ipc/src/writer.rs
+++ b/arrow-ipc/src/writer.rs
@@ -105,6 +105,17 @@ enum IpcBodySink<'a> {
Collect(&'a mut Vec<EncodedBuffer>),
}
+impl <'a> IpcBodySink<'a> {
+ /// Adds the content of the buffer to this sink
+ fn write_buffer(&mut self, buffer: Buffer) {
+ match self {
+ IpcBodySink::Write(vec) => vec.extend_from_slice(buffer.as_slice()),
+ IpcBodySink::Collect(buffers) => buffers.push(EncodedBuffer::Raw(buffer)),
+ }
+
+ }
+}
+
/// Per-message sizes produced by [`IpcDataGenerator::write`].
///
/// [`FileWriter`] uses these to build the Block index entries required by the IPC footer for
@@ -2007,7 +2018,7 @@ fn write_array_data(
)?;
for buffer in array_data.buffers().iter().skip(1) {
- offset = encode_sink_buffer(
+ offset = _buffer(
buffer.clone(),
buffers,
sink,
@@ -2235,18 +2246,19 @@ fn encode_sink_buffer(
compression_context: &mut CompressionContext,
alignment: u8,
) -> Result<i64, ArrowError> {
- let (encoded, len) = match compression_codec {
+ let len = match compression_codec {
None => {
let len = buffer.len() as i64;
- (EncodedBuffer::Raw(buffer), len)
+ sink.write_buffer(buffer);
+ len
}
Some(codec) => {
let mut scratch = Vec::new();
let written =
codec.compress_to_vec(buffer.as_slice(), &mut scratch, compression_context)?;
- let len = i64::try_from(written)
- .map_err(|e| ArrowError::InvalidArgumentError(format!("{e}")))?;
- (EncodedBuffer::Compressed(scratch), len)
+ sink.write_buffer(Buffer::from(scratch));
+ i64::try_from(written)
+ .map_err(|e| ArrowError::InvalidArgumentError(format!("{e}")))?
}
};
```
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
Review Comment:
We could probably also make the code less verbose by making `buffers`, `sink`, and `field`, fields on the IPC writer 🤔
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
Review Comment:
As a follow on, we might even be able to make this clearer by encapsulating `buffers` in some sort of other struct
```rust
struct IpcMetadataBuilder {
buffers: Vec<crate::Buffer>,
nodes: Vec<crate::FieldNode>,
}
```
And then pass that through 🤔
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4671955927
Ill push the PR after this is merged so that there wont be merge conflicts
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3370027026
##########
arrow-ipc/src/writer.rs:
##########
@@ -474,27 +517,73 @@ impl IpcDataGenerator {
write_options: &IpcWriteOptions,
compression_context: &mut CompressionContext,
) -> Result<(Vec<EncodedData>, EncodedData), ArrowError> {
+ let encoded_dictionaries = self.encode_all_dicts(
+ batch,
+ dictionary_tracker,
+ write_options,
+ compression_context,
+ )?;
+ let (encoded_message, _) =
+ self.record_batch_to_bytes(batch, write_options, compression_context, None)?;
+ Ok((encoded_dictionaries, encoded_message))
+ }
+
+ /// Encode dictionary batches for all columns in `batch`.
+ fn encode_all_dicts(
Review Comment:
Same logic appeared in both so i moved it out to its own function, no logical changes.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4645931003
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4645915589)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4645915589-475-qqxw6 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (a3f9c5382b537eb728893897950f05a3c371f1ae) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..a3f9c5382b537eb728893897950f05a3c371f1ae)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4635531181
I've been working on this all day and any further changes risk scope creep, so I'd like to split the IPC StreamWriter/FileWriter improvements and the arrow-flight work into separate PRs.
Due to async polling it's hard to distinguish what copies happen at the tonic level versus in arrow-flight. I've been profiling this locally with an additional encode_to_send benchmark that measures the full path via do_put [will include in follow up PR] @alamb does that sound like a good idea?
<img width="1263" height="262" alt="Image 6-5-26 at 4 58 PM" src="https://github.com/user-attachments/assets/3fb202c5-36e2-4941-8445-dd688342e583" />
<img width="2444" height="474" alt="Image 6-5-26 at 4 57 PM (1)" src="https://github.com/user-attachments/assets/007221dd-a0cf-4741-92c0-9ca1ab55d75b" />
<img width="2448" height="206" alt="Image 6-5-26 at 4 57 PM" src="https://github.com/user-attachments/assets/07550d6e-14d6-446b-af6d-93f9d7430989" />
_One question_: does anyone have insight into why the benchmarks behave differently on the CI workers versus locally? I saw something similar in distributed DataFusion and it came down to thread count, but beyond thread count and CPU cache size I'm not sure what else could explain the difference at this scale.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4644011061
The diff looks larger than it is due to `estimate_encoded_buffer_count()` (which estimates how many slots to pre-allocate for the buffer vector) and the if statements that determine whether `write_buffers()` or `collect_encoded_buffers()` is called based on whether a Writer was supplied. This avoids duplicating logic by reusing shared functionality across both code paths.
@gabotechs could you take another look at this when you get a chance 🚀
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3350815951
##########
arrow-ipc/src/writer.rs:
##########
@@ -1165,24 +1364,24 @@ impl<W: Write> FileWriter<W> {
));
}
- let (encoded_dictionaries, encoded_message) = self.data_gen.encode(
+ let (dict_sizes, (meta, data)) = self.data_gen.write_batch_direct(
Review Comment:
I updated the struct & variable names to hopefully make this clearer.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3350879572
##########
arrow-ipc/src/writer.rs:
##########
@@ -693,19 +734,177 @@ impl IpcDataGenerator {
let mut message_builder = crate::MessageBuilder::new(&mut fbb);
message_builder.add_version(write_options.metadata_version);
message_builder.add_header_type(crate::MessageHeader::DictionaryBatch);
- message_builder.add_bodyLength(arrow_data.len() as i64);
+ message_builder.add_bodyLength(body_len as i64);
message_builder.add_header(root);
message_builder.finish()
};
fbb.finish(root, None);
let finished_data = fbb.finished_data();
+ let mut arrow_data: Vec<u8> = Vec::with_capacity(body_len);
+ for encoded in &encoded_buffers {
+ arrow_data.extend_from_slice(encoded.as_slice());
+ arrow_data.extend_from_slice(
+ &PADDING[..pad_to_alignment(write_options.alignment, encoded.len())],
+ );
+ }
+ arrow_data.extend_from_slice(&PADDING[..tail_pad]);
+
Ok(EncodedData {
ipc_message: finished_data.to_vec(),
arrow_data,
})
}
+
+ /// Write dictionaries and record batch's directly to `writer`, skipping the
+ /// intermediate `arrow_data: Vec<u8>` accumulator used by [`Self::record_batch_to_bytes`].
+ ///
+ /// For the uncompressed path each array buffer is held as an Arc-backed slice and
+ /// written straight to `writer`. one copy instead of two. For the compressed path
+ /// each buffer is compressed into a per-buffer scratch `Vec<u8>` and written from
+ /// there, eliminating the extra copy that `write_buffer` -> `arrow_data` ->
+ /// `write_body_buffers` would otherwise incur.
+ fn write_batch_direct<W: Write>(
Review Comment:
This makes sense to me. the main issue is that `FileWriter` needs metadata while both `StreamWriter` and arrow-flight do not. Its better to not compute metadata the caller will not use but the slowdown should be negligible.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4615810079
Ran benchmarks again and the results still look good. Test are passing for arrow-flight & arrow-ipc.
@alamb could you run the benchmarks for this PR on the CI bot when you get a chance? thank you!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621173138
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621154654)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4621154654-431-g2mb7 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (04e79929305b413d35a8f1c746b10cd6c357ce41) to 97f4b14 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/97f4b1460cd32b5b8c3b91ed554238e12e3e68cf..04e79929305b413d35a8f1c746b10cd6c357ce41)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621838941
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4621805130)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
arrow_ipc_stream_writer/FileWriter/write_10 1.90 185.2±2.17µs ? ?/sec 1.00 97.3±4.50µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10 1.94 185.1±1.96µs ? ?/sec 1.00 95.4±4.87µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd 1.01 7.3±0.02ms ? ?/sec 1.00 7.2±0.03ms ? ?/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 30.0s |
| Peak memory | 2.7 GiB |
| Avg memory | 2.6 GiB |
| CPU user | 27.5s |
| CPU sys | 0.6s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 30.0s |
| Peak memory | 2.7 GiB |
| Avg memory | 2.6 GiB |
| CPU user | 29.7s |
| CPU sys | 0.1s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3371234776
##########
arrow-ipc/src/writer.rs:
##########
@@ -1808,13 +1941,15 @@ fn write_array_data(
array_data: &ArrayData,
buffers: &mut Vec<crate::Buffer>,
arrow_data: &mut Vec<u8>,
+ encoded_buffers: &mut Vec<EncodedBuffer>,
nodes: &mut Vec<crate::FieldNode>,
offset: i64,
num_rows: usize,
null_count: usize,
compression_codec: Option<CompressionCodec>,
compression_context: &mut CompressionContext,
write_options: &IpcWriteOptions,
+ is_direct: bool,
) -> Result<i64, ArrowError> {
let mut offset = offset;
Review Comment:
This is another example of my comment above, but this time reinforced by a big Clippy bypass at the top.
Ideally, we should not be contributing towards stronger Clippy violations. If you try to follow the steps above, there are good chances that we can either maintain the width of this function's signature, or even reduce it.
##########
arrow-ipc/src/writer.rs:
##########
@@ -595,16 +700,47 @@ impl IpcDataGenerator {
let mut message = crate::MessageBuilder::new(&mut fbb);
message.add_version(write_options.metadata_version);
message.add_header_type(crate::MessageHeader::RecordBatch);
- message.add_bodyLength(arrow_data.len() as i64);
+ message.add_bodyLength(body_len as i64);
message.add_header(root);
let root = message.finish();
fbb.finish(root, None);
- let finished_data = fbb.finished_data();
+ let ipc_message = fbb.finished_data().to_vec();
- Ok(EncodedData {
- ipc_message: finished_data.to_vec(),
- arrow_data,
- })
+ if let Some(w) = writer {
Review Comment:
We need to find another way of modeling this without falling into "if-driven-development" patterns.
Whenever you find yourself coding something switching execution branches with completely different bodies over booleans, it's an indicator that you are falling into an "if-driven-development" pattern, and this is will greatly hurt maintenance in the future.
One way of trying to improve this situation can be:
1. Refactor things preferring code duplication, and split into different functions with different responsibilities, even if that implies copy-pasting big quantities of code.
2. Once you have the different functions with a fair amount of copy-pasted code, try to see what are the common bits, and factor them out little by little, trying to progressively reduce the LOC count in each one.
3. If you still see functions that need to accept `bool` or `Option` parameters that have the capability of switching how the function behaves, that means the function was the wrong abstraction on the first place, so don't be afraid of tearing existing functions apart if that allows you to reuse smaller bits in different places without switching on if statements.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid Arrow IPC Copies [arrow-rs]
Posted by "gabotechs (via GitHub)" <gi...@apache.org>.
gabotechs commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4652613611
run benchmarks flight
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#discussion_r3382728834
##########
arrow-ipc/src/writer.rs:
##########
@@ -2101,50 +2226,104 @@ fn write_array_data(
Ok(offset)
}
-/// Write a buffer into `arrow_data`, a vector of bytes, and adds its
-/// [`crate::Buffer`] to `buffers`. Returns the new offset in `arrow_data`
-///
-///
-/// From <https://github.com/apache/arrow/blob/6a936c4ff5007045e86f65f1a6b6c3c955ad5103/format/Message.fbs#L58>
-/// Each constituent buffer is first compressed with the indicated
-/// compressor, and then written with the uncompressed length in the first 8
-/// bytes as a 64-bit little-endian signed integer followed by the compressed
-/// buffer bytes (and then padding as required by the protocol). The
-/// uncompressed length may be set to -1 to indicate that the data that
-/// follows is not compressed, which can be useful for cases where
-/// compression does not yield appreciable savings.
-fn write_buffer(
- buffer: &[u8], // input
- buffers: &mut Vec<crate::Buffer>, // output buffer descriptors
- arrow_data: &mut Vec<u8>, // output stream
- offset: i64, // current output stream offset
+fn encode_sink_buffer(
Review Comment:
Added some doc comments above both `write_array_data()` & `encode_sink_buffer()`. I think encapsulating buffers into a struct would be worth placing in a separate small PR. that PR would/should also include some other minor tweaks like removing the `allow(clippy::too_many_arguments)` on `write_array_data()`
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4662458538
@alamb pushed up some revisions, thank you! 🚀
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4663847622
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4663815058)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
arrow_ipc_stream_writer/FileWriter/write_10 2.01 186.5±1.56µs ? ?/sec 1.00 92.9±0.41µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10 2.06 187.0±1.58µs ? ?/sec 1.00 90.8±0.28µs ? ?/sec
arrow_ipc_stream_writer/StreamWriter/write_10/zstd 1.00 7.2±0.03ms ? ?/sec 1.01 7.3±0.03ms ? ?/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 30.0s |
| Peak memory | 11.6 MiB |
| Avg memory | 10.0 MiB |
| CPU user | 26.5s |
| CPU sys | 0.0s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 30.0s |
| Peak memory | 10.1 MiB |
| Avg memory | 9.0 MiB |
| CPU user | 28.0s |
| CPU sys | 0.0s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4663836628
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4663815058)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4663815058-525-bgdlw 6.12.68+ #1 SMP Sat May 2 07:49:07 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (70d580256415674427d779d801ec484c82ee45ca) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..70d580256415674427d779d801ec484c82ee45ca)
BENCH_NAME=ipc_writer
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4625233672
🤖 Arrow criterion benchmark running (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4625207879)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB) | `Linux bench-c4625207879-445-bfd2s 6.12.68+ #1 SMP Wed Apr 1 02:23:28 UTC 2026 aarch64 GNU/Linux`
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
Comparing rich-T-kid/optimize-arrow-ipc-copies (7acd810e743a95b3b30d7e11b9cb2ba3f6ac1a39) to d7ef673 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/d7ef673275d6b7f124d5f588146acb6c49d59a0a..7acd810e743a95b3b30d7e11b9cb2ba3f6ac1a39)
BENCH_NAME=flight
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench flight
BENCH_FILTER=
Results will be posted here when complete
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4623853576
> I wonder if we are missing a Vec::with_capacity or Vec::reserve to avoid extra allocations / copies
I think this is a strong possibility after looking at the profile, from my understanding this is mostly in arrow-flight itself and not arrow-ipc. Since arrow-flight is very dependent on arrow-ipc it make sense to start from the ground up with these optimizations.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Rich t kid/optimize arrow ipc copies [arrow-rs]
Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4625312284
🤖 Arrow criterion benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/10044#issuecomment-4625207879)
**Instance:** `c4a-highmem-16` (12 vCPU / 65 GiB)
<details><summary>CPU Details (lscpu)</summary>
```
Architecture: aarch64
CPU op-mode(s): 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: ARM
Model name: Neoverse-V2
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 16
Socket(s): -
Cluster(s): 1
Stepping: r0p1
BogoMIPS: 2000.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
L1d cache: 1 MiB (16 instances)
L1i cache: 1 MiB (16 instances)
L2 cache: 32 MiB (16 instances)
L3 cache: 80 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Not affected
```
</details>
<details><summary>Details</summary>
<p>
```
group main rich-T-kid_optimize-arrow-ipc-copies
----- ---- ------------------------------------
encode/dict/65536x1 1.05 281.7±0.67µs 892.5 MB/sec 1.00 269.4±1.07µs 933.2 MB/sec
encode/dict/65536x8 1.17 7.3±0.12ms 274.6 MB/sec 1.00 6.3±0.10ms 320.3 MB/sec
encode/dict/8192x1 1.00 34.9±0.04µs 934.5 MB/sec 1.00 34.8±0.03µs 938.7 MB/sec
encode/dict/8192x8 1.05 298.5±1.72µs 875.4 MB/sec 1.00 284.1±0.62µs 919.7 MB/sec
encode/fixed/65536x1 1.00 10.0±0.02µs 48.9 GB/sec 1.00 10.0±0.02µs 49.0 GB/sec
encode/fixed/65536x8 1.00 1003.8±2.89µs 3.9 GB/sec 1.05 1058.5±2.02µs 3.7 GB/sec
encode/fixed/8192x1 1.01 3.1±0.01µs 19.4 GB/sec 1.00 3.1±0.01µs 19.7 GB/sec
encode/fixed/8192x8 1.02 16.9±0.03µs 28.9 GB/sec 1.00 16.6±0.03µs 29.4 GB/sec
encode/nested/65536x1 1.00 28.1±0.14µs 43.4 GB/sec 1.06 29.7±0.53µs 41.1 GB/sec
encode/nested/65536x8 1.01 3.0±0.03ms 3.3 GB/sec 1.00 2.9±0.02ms 3.3 GB/sec
encode/nested/8192x1 1.00 5.8±0.01µs 26.5 GB/sec 1.00 5.7±0.01µs 26.7 GB/sec
encode/nested/8192x8 1.06 48.7±0.10µs 25.1 GB/sec 1.00 46.0±0.40µs 26.5 GB/sec
encode/variable/65536x1 1.50 73.9±0.38µs 29.7 GB/sec 1.00 49.2±0.16µs 44.6 GB/sec
encode/variable/65536x8 1.21 5.3±0.07ms 3.3 GB/sec 1.00 4.4±0.06ms 4.0 GB/sec
encode/variable/8192x1 1.18 7.0±0.01µs 39.3 GB/sec 1.00 5.9±0.01µs 46.5 GB/sec
encode/variable/8192x8 1.32 83.4±0.15µs 26.4 GB/sec 1.00 63.2±0.21µs 34.8 GB/sec
roundtrip/dict/65536x1 1.00 1279.6±46.49µs 196.5 MB/sec 1.00 1279.9±43.65µs 196.4 MB/sec
roundtrip/dict/65536x8 1.03 15.7±0.52ms 127.7 MB/sec 1.00 15.3±0.49ms 131.1 MB/sec
roundtrip/dict/8192x1 1.00 205.5±5.41µs 159.0 MB/sec 1.00 205.1±5.68µs 159.3 MB/sec
roundtrip/dict/8192x8 1.00 1307.2±44.46µs 199.9 MB/sec 1.01 1317.0±53.52µs 198.4 MB/sec
roundtrip/fixed/65536x1 1.00 303.4±5.86µs 1648.1 MB/sec 1.02 308.6±4.48µs 1620.3 MB/sec
roundtrip/fixed/65536x8 1.00 2.2±0.03ms 1857.5 MB/sec 1.52 3.3±0.19ms 1224.0 MB/sec
roundtrip/fixed/8192x1 1.02 90.2±1.71µs 694.0 MB/sec 1.00 88.4±1.47µs 707.7 MB/sec
roundtrip/fixed/8192x8 1.00 324.8±3.20µs 1541.5 MB/sec 1.00 326.3±3.73µs 1534.4 MB/sec
roundtrip/nested/65536x1 1.00 832.1±42.06µs 1502.4 MB/sec 1.02 844.9±46.87µs 1479.6 MB/sec
roundtrip/nested/65536x8 1.00 9.5±0.62ms 1051.7 MB/sec 1.03 9.8±0.51ms 1023.3 MB/sec
roundtrip/nested/8192x1 1.01 157.5±5.94µs 993.3 MB/sec 1.00 156.1±6.26µs 1002.2 MB/sec
roundtrip/nested/8192x8 1.00 894.7±45.10µs 1399.0 MB/sec 1.00 897.4±45.96µs 1394.7 MB/sec
roundtrip/variable/65536x1 1.00 1201.3±32.52µs 1873.1 MB/sec 1.42 1700.7±124.37µs 1323.1 MB/sec
roundtrip/variable/65536x8 1.08 16.0±0.87ms 1127.4 MB/sec 1.00 14.7±0.57ms 1222.9 MB/sec
roundtrip/variable/8192x1 1.02 204.2±5.80µs 1378.3 MB/sec 1.00 200.9±5.67µs 1400.5 MB/sec
roundtrip/variable/8192x8 1.00 1208.2±29.51µs 1863.4 MB/sec 1.29 1553.8±151.44µs 1449.0 MB/sec
```
</p>
</details>
<details><summary>Resource Usage</summary>
**base (merge-base)**
| Metric | Value |
|--------|-------|
| Wall time | 335.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 340.4s |
| CPU sys | 74.4s |
| Peak spill | 0 B |
**branch**
| Metric | Value |
|--------|-------|
| Wall time | 330.1s |
| Peak memory | 3.4 GiB |
| Avg memory | 3.4 GiB |
| CPU user | 325.2s |
| CPU sys | 84.2s |
| Peak spill | 0 B |
</details>
---
[File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044#issuecomment-4673440800
2x faster is pretty sweet. Thank you again @Rich-T-kid and @gabotechs
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Reduce copies in Arrow IPC writer [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #10044:
URL: https://github.com/apache/arrow-rs/pull/10044
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org