vichry2 commented on issue #6670:
URL: https://github.com/apache/arrow-rs/issues/6670#issuecomment-2453511648

   I was able to reduce `libsystem_malloc` overhead, visible in the flamegraph 
by doing something similar to what you proposed @tustvold. 
   This resulted in the following flamegraph: 
   
![flamegraph](https://github.com/user-attachments/assets/17ca7702-07ed-4142-8e2f-04a4e953e38e)
   
   I used 
https://docs.rs/arrow/latest/arrow/record_batch/struct.RecordBatch.html#method.get_array_memory_size
 to estimate the size of the `arrow_data` vec in `record_batch_to_bytes` -- and 
initialized the vec with `Vec::with_capacity(array_memory_size)`. This would 
likely overestimate the size of the arrow_data vector created, hence not be 
optimal for memory consumption, but that's beside the point.
   The point being that the bottleneck is related to memory movement, and as 
you mentioned, if the response requires that data be in contiguous blocks of 
memory, not sure there is a solution to this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to