merlimat opened a new pull request, #3810:
URL: https://github.com/apache/bookkeeper/pull/3810

   ### Motivation
   
   In `DigestManager.verifyDigestAndReturnData()` there are a couple of simple 
improvements: 
   
    1. For the temp buffer where to store the digest, do not acquire a buffer 
from the pool each time. Instead, use a thread-local buffer.
    2. Instead of taking slices() at each time, extend the interface to take a 
"offset, length" pair and save the allocations.
    
   
   ### Benchmarks: 
   
   #### Before
   
   ```
   Benchmark                            (entrySize)   Mode  Cnt      Score     
Error   Units
   DigestManagerBenchmark.verifyDigest           64  thrpt    3  13533.060 ± 
131.004  ops/ms
   DigestManagerBenchmark.verifyDigest         1024  thrpt    3   7544.684 ± 
669.817  ops/ms
   DigestManagerBenchmark.verifyDigest         4086  thrpt    3   3171.914 ± 
173.051  ops/ms
   DigestManagerBenchmark.verifyDigest         8192  thrpt    3   1789.657 ±  
33.677  ops/ms
   ```
   
   Allocations: 230 bytes per operation
   
   #### After
   
   ```
   Benchmark                            (entrySize)   Mode  Cnt      Score      
Error   Units
   DigestManagerBenchmark.verifyDigest           64  thrpt    3  28108.235 ± 
2319.595  ops/ms
   DigestManagerBenchmark.verifyDigest         1024  thrpt    3  10245.652 ± 
4175.297  ops/ms
   DigestManagerBenchmark.verifyDigest         4086  thrpt    3   3527.974 ±  
475.364  ops/ms
   DigestManagerBenchmark.verifyDigest         8192  thrpt    3   1871.765 ±  
227.182  ops/ms
   ```
   
   Allocations: 64 bytes per operation
   
   Note: these remaining 64 bytes are only due to the Java9 reflection access. 
It would not be present on the JNI-based CRC32c backend (though that does not 
work on Mac M1).
   
   
![image](https://user-images.githubusercontent.com/62500/221421437-702e4fa0-a2b3-41bb-aefa-bd8368fff4b9.png)
   


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