DomGarguilo commented on issue #2165:
URL: https://github.com/apache/accumulo/issues/2165#issuecomment-896174440


   Moved the tests to JMH and separated the data types into separate 
benchmarks. An example of one is as follows where the Unsyncronized versions 
and data types are swapped out for the other:
   <details closed>
   
   <summary>Test example</summary>
   
   ```java
       @Benchmark
       public void testUnsyncInt() throws IOException {
           try (UnsynchronizedByteArrayOutputStream baos = new 
UnsynchronizedByteArrayOutputStream();
                DataOutputStream dos = new DataOutputStream(baos)) {
               int out = MyState.random.nextInt();
               dos.writeInt(out);
               try (UnsynchronizedByteArrayInputStream bais = new 
UnsynchronizedByteArrayInputStream(baos.toByteArray());
                    DataInputStream dis = new DataInputStream(bais)) {
                   assertEquals(dis.readInt(), out);
               }
           }
       }
   ```
   </details>
   
   The results of the tests are as follows:
   
   ```
   Benchmark                      Mode  Cnt  Score    Error  Units
   MyBenchmark.testClassicDouble  avgt   25  0.088 ±  0.001  us/op
   MyBenchmark.testClassicInt     avgt   25  0.108 ±  0.001  us/op
   MyBenchmark.testClassicString  avgt   25  0.347 ±  0.002  us/op
   MyBenchmark.testUnsyncDouble   avgt   25  0.200 ±  0.006  us/op
   MyBenchmark.testUnsyncInt      avgt   25  0.228 ±  0.022  us/op
   MyBenchmark.testUnsyncString   avgt   25  0.419 ±  0.012  us/op
   ```
   Not too sure how well these tests map to our use cases. If there are any 
suggestions for additional tests/test tweaks that might be able to better show 
which of these byte streams would be best for us that would be great.
   


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