<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#467886;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">(I may have used the wrong email address earlier today so sending this again)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">If there is a better mailing list to ask my questions about the JMH then please let me know. I will be presenting a session at JavaZone next month entitled ”I Just Discovered the Java Microbenchmark Harness and You Should
To”. Some years ago, I used System.nanoTime to measure performance of the Java Collections for a course I was giving. The results were relatively correct, i.e. LinkedLists are slow, but I knew they were far from accurate. They also changed radically from
run to run. I did a similar presentation two years ago but for this version I wish to present what will effectively be a tutorial on the best use of the JMH. To that end I have just a few questions.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The first most obvious question is if there are JavaDocs. Experimentation has revealed to me much of how the JMH works. There are many good articles on the JMH, but none are complete which is what leads to the next two
questions.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">When is a new JVM spun up for testing? Does it happen for every fork, warmup, or iteration? In reviewing my results, I see that the first Warmup Iteration is usually twice what the subsequent warmup iterations are and
that the Iteration values are usually all close together. I am using the default of 5 forks and iterations, both in 10s. I am using Java 21.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">What does this option mean:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">.jvmArgsAppend("-Djmh.stack.period=1") mean<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I found it in this file at <a href="https://github.com/xp-vit/java-logging-performance-tests%20in%20the%20BenchmarkUtils.java">https://github.com/xp-vit/java-logging-performance-tests in the BenchmarkUtils.java</a>.
I do not perceive a difference if I use it or not.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Please feel free to recommend any topics or concepts that should be presented. The session is only an hour, but I fear I may already have enough for two or three hours. As running tests can be time consuming, I will show
the results of tests I performed previously. A single test class with 23 methods took three and a half hours to run last night.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Here is the setup for each test running under Windows 11:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># JMH version: 1.37<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># VM version: JDK 21.0.2, OpenJDK 64-Bit Server VM, 21.0.2+13-LTS<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># VM invoker: C:\Program Files\Eclipse Adoptium\jdk-21.0.2.13-hotspot\bin\java.exe<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># VM options: -server -Djmh.stack.period=1<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Warmup: 5 iterations, 10 s each<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Measurement: 5 iterations, 10 s each<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Timeout: 10 min per iteration<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Threads: 1 thread, will synchronize iterations<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># Benchmark mode: Average time, time/op<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you for your time.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Ken Fogel<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>