JinwooHwang commented on PR #8075:
URL: https://github.com/apache/geode/pull/8075#issuecomment-5820908292

   The stream now buffers each chunk in 8 KiB segments that are allocated only 
when needed and reused for later chunks. Each chunk is copied once into an 
exactly sized array, so the buffer never grows by copying.
   
   Allocation per stream in bytes (JDK 17, ThreadMXBean, best of 21 runs across 
3 JVMs, 1000-byte writes, open through close):
   
   | Written | develop | GEODE-10646 |
   |---|---:|---:|
   | 1,000 B | 1,056,080 | 16,144 |
   | 64 KiB | 1,120,616 | 138,136 |
   | 512 KiB | 1,579,368 | 1,056,536 |
   | 1 MiB | 2,103,656 | 2,106,136 |
   | 5 MiB | 6,323,528 | 6,325,880 |
   
   From 1 MiB up, allocation is now within 2.5 KB of develop. Small and medium 
files keep the savings.
   
   I added `testLargeFileAllocatesAtMostOneChunkBeyondItsLength`, which caps 
allocation for a 1.5 MiB file at its length plus one chunk. It fails on the 
previous commit (3,677,560 bytes) and passes now.
   


-- 
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