-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Similar to #766, performance of writes of blob content could be improved (especially for the pure Java implementation) by writing the segments directly from the array to the network stream (or the buffer used by JNA), skipping intermediate buffers. This would especially be worth it for byte arrays larger than the blobBufferSize, because right now large byte arrays will be copied over in blobBufferSize lengths, and writes with different offset or length not equal to the array size will be copied too as (max) blobBufferSize lengths, while writing from the source array directly into the network stream would allow us to write with the maximum segment size.
This will probably even be beneficial for writes larger than 50% of the blob buffer size under the assumption that multiple writes with that size will happen right after each other, because in the existing implementation, two writes of 50% + 1 will
- First write with size >
blobBufferSize/ 2 and size <blobBufferSizewill copy into the buffer of the blob output stream - Second write with size >
blobBufferSize/ 2 and size <blobBufferSizewill flush that buffer, and then write itself (possibly with additional copying)
If the first write had directly gone to the network stream, we could have skipped the overhead of copying to the buffer (and then from the buffer to the network).
We might also be able to coalesce the buffer flush and a subsequent write into a single segment, but that might raise the complexity too much.