sodonnel commented on PR #5364: URL: https://github.com/apache/ozone/pull/5364#issuecomment-1736236356
I benchmarked something similar to the above with some code I added in #1910 but has since been removed. The byte by byte approach is very slow. In my test it was at about 70 ops per second. Using the original code, assuming hasArray() returns true, gives about 2000 ops per second. Then I changed my code to have a second byteBuffer. Copied the data into it and then ran the test and it dropped to about 1850 ops per second. This was with an Indirect buffer. Finally I tried again with a "Direct" buffer `private static ByteBuffer data3 = DirectByteBufferAllocator.INSTANCE.allocate(1024 * 1024);` - this was actually slower at 1400 ops per second. I have no idea why the Direct is slower than indirect, and this was run on my laptop. Apple M1 Java 11, so different OS / Java may vary. @jojochuang Suggested there may be some reflection hacks to get access to the underlying byte array inside the ByteString, which could allow us to avoid copying the data at all. -- 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]
