yandrey321 commented on PR #10438:
URL: https://github.com/apache/ozone/pull/10438#issuecomment-4632687039

   > before this change every put(byte[], offset, length ):
   > 
   > Allocates a new ByteBuffer view (HeapByteBuffer over the same backing 
array). Dispatches to put(ByteBuffer), which for list/incremental buffers runs 
a segment loop that adjusts the wrapper’s position/limit and copies via 
ByteBuffer.put(ByteBuffer).
   > 
   > On the client write path, BlockOutputStream.write(byte[], …) calls 
currentBuffer.put(b, off, writeLen) once per slice that fits in the current 
chunk buffer. Large writes can do that many times per write() call.
   > 
   > wrap itself is “cheap” (no array copy), but per call it still pays object 
allocation + dispatch into the ByteBuffer put path. On a hot path called for 
every slice of every write(byte[]), that cost is measurable under load.
   > 
   > the fix is micro-optimization, but should reduce memory allocations on hot 
path and reduce number of objects for garbage collection.
   
   I update the description:
   
   before this change every put(byte[], offset, length ):
   
   Allocates a new ByteBuffer view (HeapByteBuffer over the same backing array).
   Dispatches to put(ByteBuffer), which for list/incremental buffers runs a 
segment loop that adjusts the wrapper’s position/limit and copies via 
ByteBuffer.put(ByteBuffer).
   
   On the client write path, BlockOutputStream.write(byte[], …) calls 
currentBuffer.put(b, off, writeLen) once per slice that fits in the current 
chunk buffer. Large writes can do that many times per write() call.
   
   wrap itself is “cheap” (no array copy), but per call it still pays object 
allocation + dispatch into the ByteBuffer put path. On a hot path called for 
every slice of every write(byte[]), that cost is measurable under load.
   
   the fix is micro-optimization, but should reduce memory allocations on hot 
path and reduce number of objects for garbage collection.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to