Home | History | Annotate | Download | only in benchmarks
      1 Okio Benchmarks
      2 ------------
      3 
      4 This module contains microbenchmarks that can be used to measure various aspects of performance for Okio buffers. Okio benchmarks are written using JMH (version 1.4.1 at this time) and require Java 7.
      5 
      6 Running Locally
      7 -------------
      8 
      9 To run benchmarks locally, first build and package the project modules:
     10 
     11 ```
     12 $ mvn clean package
     13 ```
     14 
     15 This should create a `benchmarks.jar` file in the `target` directory, which is a typical JMH benchmark JAR:
     16 
     17 ```
     18 $ java -jar benchmarks/target/benchmarks.jar -l
     19 Benchmarks: 
     20 com.squareup.okio.benchmarks.BufferPerformanceBench.cold
     21 com.squareup.okio.benchmarks.BufferPerformanceBench.threads16hot
     22 com.squareup.okio.benchmarks.BufferPerformanceBench.threads1hot
     23 com.squareup.okio.benchmarks.BufferPerformanceBench.threads2hot
     24 com.squareup.okio.benchmarks.BufferPerformanceBench.threads32hot
     25 com.squareup.okio.benchmarks.BufferPerformanceBench.threads4hot
     26 com.squareup.okio.benchmarks.BufferPerformanceBench.threads8hot
     27 ```
     28 
     29 More help is available using the `-h` option. A typical run on Mac OS X looks like:
     30 
     31 ```
     32 $ /usr/libexec/java_home -v 1.7 --exec java -jar benchmarks/target/benchmarks.jar \
     33 "cold" -prof gc,hs_rt,stack -r 60 -t 4 \
     34 -jvmArgsPrepend "-Xms1G -Xmx1G -XX:+HeapDumpOnOutOfMemoryError"
     35 ```
     36 
     37 This executes the "cold" buffer usage benchmark, using the default number of measurement and warm-up iterations, forks, and threads; it adjusts the thread count to 4, iteration time to 60 seconds, fixes the heap size at 1GB and profiles the benchmark using JMH's GC, Hotspot runtime and stack sampling profilers.
     38 
     39