Monday, February 18, 2008

System.Nanotimer benchmarks

i wrote a small java benchmark to see grab the System.nanoTimer value. On this machine there's like a hard 558 ns limit on the x64 jdk 1.6._10 and 698 lower limit on the 32 bit jre.
In this test I also tested out the atomics and the difference between capture times of buffer and arrays. buffers and arrays are virtually identical performance surrounding the nanotime pull

Directbuffer storage access seems to be the consistent lagger, as is expected. The atomics in the java.utils.concurrent.atomic.LongArray class is not so fast ... Boxing also has a lower average than norm.

of note: the jit works well, they all tend to share the lowest access times(hard limit mentioned above)

it looks like factoring out the call to System.nanoTimer will shave perhaps 500 or so nanoseconds from each loop iteration.

edit:
it was noted from others that variance was pretty high here... the goal of the effort was partially exploring JIT local mediums as well.

Further bench results will probably have some cool visualizations to check out.

see here for source:

http://www.google.com/notebook/public/18239550943564485025/BDQ5wIgoQxbPnoIIj#SDR5nIgoQlITsoIIj

O:\opt\java\jdk1.6.0_10\bin\java -Didea.launcher.port=7536 -Didea.launcher.bin.path=M:\opt\JetBrains\intellij-702\bin -Dfile.encoding=windows-1252 -classpath O:\opt\java\jdk1.6.0_10\jre\lib\charsets.jar;O:\opt\java\jdk1.6.0_10\jre\lib\jce.jar;O:\opt\java\jdk1.6.0_10\jre\lib\jsse.jar;O:\opt\java\jdk1.6.0_10\jre\lib\management-agent.jar;O:\opt\java\jdk1.6.0_10\jre\lib\resources.jar;O:\opt\java\jdk1.6.0_10\jre\lib\rt.jar;O:\opt\java\jdk1.6.0_10\jre\lib\ext\dnsns.jar;O:\opt\java\jdk1.6.0_10\jre\lib\ext\localedata.jar;O:\opt\java\jdk1.6.0_10\jre\lib\ext\sunjce_provider.jar;M:\work\enigmatrie\target\production\enigmatrie;M:\opt\JetBrains\intellij-702\lib\junit.jar;M:\opt\JetBrains\intellij-702\lib\idea_rt.jar com.intellij.rt.execution.application.AppMain com.glamdringinc.benchmark.SystemNanotimerCapture

[{{tester; stat_arr} {avg; 663} {low; 558} {mid; 629} {hi; 13969} {variance;6705}
, {{tester; stat_fin_arr} {avg; 664} {low; 558} {mid; 629} {hi; 22419} {variance;10930}
, {{tester; arr} {avg; 667} {low; 558} {mid; 629} {hi; 31499} {variance;15470}
, {{tester; vol_arr} {avg; 676} {low; 558} {mid; 629} {hi; 38482} {variance;18962}
, {{tester; fin_arr} {avg; 677} {low; 558} {mid; 629} {hi; 48610} {variance;24026}
, {{tester; heap_buff_absolute} {avg; 683} {low; 558} {mid; 629} {hi; 33314} {variance;16378}
, {{tester; array_backed_buf_absolute} {avg; 689} {low; 558} {mid; 629} {hi; 33594} {variance;16518}
, {{tester; atom_arr_lazyset} {avg; 697} {low; 558} {mid; 629} {hi; 39739} {variance;19590}
, {{tester; array_backed_buffer} {avg; 698} {low; 558} {mid; 698} {hi; 38203} {variance;18822}
, {{tester; vol_val} {avg; 710} {low; 558} {mid; 698} {hi; 42952} {variance;21197}
, {{tester; atomic_arr_cmp_set} {avg; 714} {low; 558} {mid; 698} {hi; 39739} {variance;19590}
, {{tester; atomic_arr_set} {avg; 719} {low; 558} {mid; 698} {hi; 87022} {variance;43232}
, {{tester; heap_buf_unbox} {avg; 723} {low; 558} {mid; 698} {hi; 65302} {variance;32372}
, {{tester; mmap_buf_get_prv} {avg; 725} {low; 558} {mid; 698} {hi; 65790} {variance;32616}
, {{tester; atomic_arr_getset} {avg; 728} {low; 558} {mid; 698} {hi; 35479} {variance;17460}
, {{tester; dir_buf_get} {avg; 742} {low; 558} {mid; 698} {hi; 41765} {variance;20603}
, {{tester; mmap_buf_get_rw} {avg; 751} {low; 558} {mid; 698} {hi; 65721} {variance;32581}
]


Process finished with exit code 0

No comments: