tag:blogger.com,1999:blog-57388203093227334472024-03-19T02:22:16.269-07:00Java Micro Benchmarking Anonymoushttp://www.blogger.com/profile/15420849859256187745noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5738820309322733447.post-81385556260265133002014-05-30T23:05:00.000-07:002014-05-30T23:05:26.035-07:00Overview<div dir="ltr" style="text-align: left;" trbidi="on">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Courier New";
panose-1:2 7 3 9 2 2 5 2 4 4;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073711037 9 0 511 0;}
@font-face
{font-family:Times;
panose-1:2 0 5 0 0 0 0 0 0 0;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 0 0 0 1 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:"MS 明朝";
mso-font-charset:78;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1791491579 18 0 131231 0;}
@font-face
{font-family:"MS ゴシック";
mso-font-charset:78;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1791491579 18 0 131231 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1073743103 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Cambria;
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"MS 明朝";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
h1
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 1 Char";
mso-style-next:Normal;
margin-top:24.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan lines-together;
page-break-after:avoid;
mso-outline-level:1;
font-size:16.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"MS ゴシック";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#345A8A;
mso-themecolor:accent1;
mso-themeshade:181;
mso-font-kerning:0pt;
font-weight:bold;}
h2
{mso-style-priority:9;
mso-style-qformat:yes;
mso-style-link:"Heading 2 Char";
mso-style-next:Normal;
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan lines-together;
page-break-after:avoid;
mso-outline-level:2;
font-size:13.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
a:link, span.MsoHyperlink
{mso-style-noshow:yes;
mso-style-priority:99;
color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-noshow:yes;
mso-style-priority:99;
color:purple;
mso-themecolor:followedhyperlink;
text-decoration:underline;
text-underline:single;}
p
{mso-style-noshow:yes;
mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Times;
mso-fareast-font-family:"MS 明朝";
mso-fareast-theme-font:minor-fareast;
mso-bidi-font-family:"Times New Roman";}
code
{mso-style-noshow:yes;
mso-style-priority:99;
font-family:Courier;
mso-ascii-font-family:Courier;
mso-fareast-font-family:"MS 明朝";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Courier;
mso-bidi-font-family:Courier;}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 1";
mso-ansi-font-size:16.0pt;
mso-bidi-font-size:16.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"MS ゴシック";
mso-fareast-theme-font:major-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:major-bidi;
color:#345A8A;
mso-themecolor:accent1;
mso-themeshade:181;
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-priority:9;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"Heading 2";
mso-ansi-font-size:13.0pt;
mso-bidi-font-size:13.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:major-latin;
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:major-latin;
mso-bidi-font-family:"Times New Roman";
color:#4F81BD;
mso-themecolor:accent1;
font-weight:bold;}
span.entity-name
{mso-style-name:entity-name;
mso-style-unhide:no;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:Cambria;
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"MS 明朝";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:107700048;
mso-list-template-ids:-1426699662;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:128132737;
mso-list-type:hybrid;
mso-list-template-ids:-798295610 -987071136 805069928 1985743014 263590912 -2142476938 -80675592 1197133162 -39035510 -652196486;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2
{mso-list-id:602029513;
mso-list-type:hybrid;
mso-list-template-ids:140160990 1940569766 1942501136 -331742962 -270997388 1518896614 942726218 -1586587990 1832273836 -353479932;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l2:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l3
{mso-list-id:895314230;
mso-list-template-ids:390387726;}
@list l3:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l3:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l3:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l3:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l4
{mso-list-id:935678112;
mso-list-type:hybrid;
mso-list-template-ids:-1674008714 180404140 -458858440 -715109592 -1161684602 -2063160552 856717234 -1917678480 332429970 -986149894;}
@list l4:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l4:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5
{mso-list-id:946498158;
mso-list-type:hybrid;
mso-list-template-ids:-1231759064 -1801669090 1436088378 -1841146312 39193482 401349722 -46901662 1573320718 -881696172 -2007197020;}
@list l5:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l5:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6
{mso-list-id:1113358213;
mso-list-type:hybrid;
mso-list-template-ids:-831122264 -432884042 -247954642 -198005436 -1398878306 -2079656042 -647887494 -1651190600 326950664 -595546200;}
@list l6:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l7
{mso-list-id:1204833064;
mso-list-template-ids:326796104;}
@list l7:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l7:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l7:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l7:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l8
{mso-list-id:1209413546;
mso-list-type:hybrid;
mso-list-template-ids:-1267534064 -510131344 462709804 1590196154 -1405294264 -194510492 -1365345972 -891018064 -1188897996 -732671300;}
@list l8:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l8:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9
{mso-list-id:1689679564;
mso-list-type:hybrid;
mso-list-template-ids:1921841210 1775529790 439356164 -269607498 921607418 -1618437200 642797820 1611558030 -569481612 -145964342;}
@list l9:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l9:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10
{mso-list-id:1815297512;
mso-list-type:hybrid;
mso-list-template-ids:1802662176 1802896804 -964940042 445429174 -2062386320 -55300364 -1736527852 1866727504 1935709330 957230314;}
@list l10:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l10:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
<br />
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081954">Challenges</a><span style="mso-no-proof: yes;"></span></h1>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Here
are some of the quick challenges in regular development activities:</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<ul type="disc">
<li class="MsoNormal" style="mso-list: l3 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">How to justify my new version of logic is better than
older version</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">How to justify new features of jdk like parallel stream
is better than sequential stream</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">How to compare same logic with various load conditions
(samples)</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l3 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">How to compare logic under different environment
variables / jvm settings/ GC enforce or not.</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
</ul>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">One of
the quick solutions is to use nice benchmarking tool. A benchmark is meant to
measure the performances apiece of software. An attempt to reproduce in
laboratory what will happen in production. <span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Open
JDK has come up with nice tool called <span style="mso-field-code: " HYPERLINK \0022http\:\/\/openjdk\.java\.net\/projects\/code-tools\/jmh\/\0022 \\o \0022JHM\0022 \\t \0022_blank\0022 ";"><u><span style="color: blue;">JHM</span></u></span>.</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081955">Overview</a> </h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">JMH (Java
Microbenchmark Harness ) </span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">is a
Java harness for building, running, and analyzing nano/micro/milli/macro
benchmarks written in Java and other languages targeting the JVM. JMH is
Maven-driven, hence having </span><a href="http://maven.apache.org/"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Maven</span></a><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
installed will bring the best experience. </span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">JMH
allowed us to deeply understand implementation details, which were impacting
execution and concurrency of our new implementation. JMH is certainly a tool
that you'll want to bring into your toolbox if you have any care at all for
understanding the performance of your applications (more importantly down a the
algorithm and language level).</span><br />
<div style="margin-bottom: 7.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">One
advantage of JMH over Caliper is that it runs on Windows.</span></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081956">Setup</a></h1>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Please
go through <span style="mso-field-code: " HYPERLINK \0022http\:\/\/openjdk\.java\.net\/projects\/code-tools\/jmh\/\0022 \\t \0022_blank\0022 ";"><u><span style="color: blue;">JHM</span></u></span> portal for more details of setup.</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081957">Sample Code</a></h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">JMH
has only 2 requirements (everything else are recommendations): </span></div>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l7 level1 lfo3; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">You need jmh-core maven dependency</span></li>
<li class="MsoNormal" style="mso-list: l7 level1 lfo3; tab-stops: list 36.0pt;"><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">You need to annotate test methods
with @<i style="mso-bidi-font-style: normal;">GenerateMicroBenchmark</i>
annotation</span></li>
</ul>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Annotate
the required methods with @GenerateMicroBenchmark. Typical JMH code with annotation
"@<i style="mso-bidi-font-style: normal;">GenerateMicroBenchmark</i>"
will looks like below:</span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><i><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
@GenerateMicroBenchmark<br />
@OutputTimeUnit(TimeUnit.SECONDS)</span></i></b><i><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"><br />
public void performSerailStream(){<br />
long rangeEnd =10000L;<br />
long startTime
=System.currentTimeMillis();<br />
List<Long> perfectNumbers =<br />
LongStream.rangeClosed(1, rangeEnd).<br />
filter(PerfectNumberFinderBenchMark::isPerfect).<br />
collect(ArrayList<Long>::new, ArrayList<Long>::add,
ArrayList<Long>::addAll);<br />
}<br />
<br />
<br />
<b> @GenerateMicroBenchmark<br />
@OutputTimeUnit(TimeUnit.SECONDS)</b><br />
public void performParallelStream(){<br />
long rangeEnd =10000L;<br />
long startTime
=System.currentTimeMillis();<br />
List<Long> perfectNumbers1 =<br />
LongStream.rangeClosed(1, rangeEnd).parallel().<br />
filter(PerfectNumberFinderBenchMark::isPerfect).<br />
collect(ArrayList<Long>::new, ArrayList<Long>::add,
ArrayList<Long>::addAll); </span></i><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"><br />
<i> }</i></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">More
JMH samples are can be from </span><a href="http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/">here</a><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">.</span></div>
<div class="MsoNormal">
<br /></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081958">Sample Output</a></h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Here
are the benchmark output details with different mode of operations (Throughput/thrpt,AverageTime/avgt,
SampleTime/sample, SingleShotTime/ss ) are shown below:</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ6m7TS_ts26FYLKsMH9EXziMGHe4QOYAYvdQrdUDyhc1XbgiGLyR0putDZKgTD1hDBDOue3lm7uKPXawHrRKIPs43WS2jxkL_mmevuKr0KHuxa7VbiXu9D9l8J2qvVsRUHi7Kl3xm0tTN/s1600/JmhSample.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ6m7TS_ts26FYLKsMH9EXziMGHe4QOYAYvdQrdUDyhc1XbgiGLyR0putDZKgTD1hDBDOue3lm7uKPXawHrRKIPs43WS2jxkL_mmevuKr0KHuxa7VbiXu9D9l8J2qvVsRUHi7Kl3xm0tTN/s1600/JmhSample.png" height="192" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; mso-no-proof: yes;"><br /></span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<div class="MsoNormal">
<br /></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081959">How it Works?</a></h1>
<div class="MsoNormal">
<br /></div>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l10 level1 lfo4; tab-stops: list 36.0pt;">Finds
annotated micro-benchmarks using reflection</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l9 level1 lfo5; tab-stops: list 36.0pt;">Generates
infrastructure plain java source code around the calls to the
micro-benchmarks</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l8 level1 lfo6; tab-stops: list 36.0pt;">Compile,
pack, run, profit</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l5 level1 lfo7; tab-stops: list 36.0pt;">No
reflection during benchmark execution</li>
</ul>
<div class="MsoNormal">
<br /></div>
<h1>
<a href="https://www.blogger.com/null" name="_Toc263081960">Customization</a></h1>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Lot of customizations is supported from run time and through
annotation base. So many metrics can be measured, some of them are:</div>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l6 level1 lfo8; tab-stops: list 36.0pt;">Single
execution time</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l1 level1 lfo9; tab-stops: list 36.0pt;">Operations
per time unit</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l2 level1 lfo10; tab-stops: list 36.0pt;">Average
time per operation</li>
</ul>
<ul style="margin-top: 0cm;" type="disc">
<li class="MsoNormal" style="mso-list: l4 level1 lfo11; tab-stops: list 36.0pt;">Percentile
estimation of time per operation</li>
</ul>
<div class="MsoNormal">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081961">Run time:</a></h2>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Some
of important options to customize the output are:</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"></span></div>
<ul type="disc">
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">bm <mode></span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> - Benchmark mode. Available modes are:
[Throughput/thrpt,AverageTime/avgt, SampleTime/sample, SingleShotTime/ss,All/all]</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">i</span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
- number of benchmarked iterations, use 10 or more to get a good idea</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">r</span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
- how long to run each benchmark iteration</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">wi</span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
- number of warmup iterations</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">w </span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">-
how long to run each warmup iteration (give ample room for warmup, how much
will depend on the code you try and measure, try and have it execute 100K
times or so)</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
<li class="MsoNormal" style="mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">gc [bool]</span></b><span style="font-family: Calibri; font-size: 10.5pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> - Should JMH force
GC between iterations?</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> </span></li>
</ul>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081962">Annotations</a></h2>
<div class="MsoNormal">
JMH uses annotation-drive approach to detect benchmarks. It Provides
BlackHole to consume results (and CPU cycles) </div>
<div class="MsoNormal">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081963"><span class="entity-name">GenerateMicroBenchmark</span></a></h2>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Marks the payload method as the target for microbenchmark
generation. Annotation processors will translate methods marked with this
annotation to correct MicroBenchmark-annotated classes. </span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">This
annotation only accepts parameters affecting the workload generation, now only </span><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.openjdk.jmh/jmh-core/0.1/org/openjdk/jmh/annotations/Mode.java#Mode" title="org.openjdk.jmh.annotations.Mode"><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; text-decoration: none; text-underline: none;">Mode</span></a><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">. Other parameters for run control are available as separate
annotations (e.g. </span><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.openjdk.jmh/jmh-core/0.1/org/openjdk/jmh/annotations/Measurement.java#Measurement" title="org.openjdk.jmh.annotations.Measurement"><span style="color: windowtext; font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; text-decoration: none; text-underline: none;">Measurement</span></a><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">, </span><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.openjdk.jmh/jmh-core/0.1/org/openjdk/jmh/annotations/Threads.java#Threads" title="org.openjdk.jmh.annotations.Threads"><span style="color: windowtext; font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; text-decoration: none; text-underline: none;">Threads</span></a><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">, and </span><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.openjdk.jmh/jmh-core/0.1/org/openjdk/jmh/annotations/Fork.java#Fork" title="org.openjdk.jmh.annotations.Fork"><span style="color: windowtext; font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; text-decoration: none; text-underline: none;">Fork</span></a><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">), which can be used both for concrete </span><a href="http://grepcode.com/file/repo1.maven.org/maven2/org.openjdk.jmh/jmh-core/0.1/org/openjdk/jmh/annotations/GenerateMicroBenchmark.java#GenerateMicroBenchmark" title="org.openjdk.jmh.annotations.GenerateMicroBenchmark"><span style="color: windowtext; font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin; text-decoration: none; text-underline: none;">GenerateMicroBenchmark</span></a><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">-annotated
methods, as well as for the classes containing target methods. Class-level
annotations will be honored first, then any method-level annotations. </span></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081964">State</a> <span style="mso-spacerun: yes;"> </span></h2>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: Courier; mso-hansi-theme-font: major-latin;">@State</span></b><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;"> annotation defines the scope in which
an instance of a given class will be available. JMH allows you to run tests in
multiple threads simultaneously, so choose the right state: </span></div>
<table border="1" cellpadding="0" class="MsoNormalTable" style="mso-cellspacing: 1.5pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Name</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Description</span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 1;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Scope.Thread</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">This
is a default state. An instance will be allocated for each thread running the
given test.</span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 2;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Scope.Benchmark</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">An
instance will be shared across all threads running the same test. Could be
used to test multithreaded performance of a state object (or just mark your
benchmark with this scope). </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 3; mso-yfti-lastrow: yes;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Scope.Group</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">An
instance will be allocated per thread group (see Groups section down below).</span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Besides
marking a separate class as a </span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: Courier; mso-hansi-theme-font: major-latin;">@State</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">, you can also mark your own benchmark
class as </span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: Courier; mso-hansi-theme-font: major-latin;">@State</span><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">. All
above scope rules apply to this case as well. </span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">@State
of benchmark data is shared across the benchmark, thread, or a group of threads.
It allows performing Fixtures (setUp and tearDown) in scope of the whole run,
iteration or single execution</span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">@Threads
a simple way to run concurrent test if you defined correct @State</span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">@Group
threads to assign them for a particular role in the benchmark</span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081965">BenchmarkMode</a></h2>
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">You can use the following test modes
specified using </span><code><b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">@BenchmarkMode</span></b></code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;"> annotation
on the test methods: </span><br />
<table border="1" cellpadding="0" class="MsoNormalTable" style="mso-cellspacing: 1.5pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Name</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Description</span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 1;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Mode.Throughput</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Calculate number of
operations in a time unit. </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 2;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Mode.AverageTime</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Calculate an average
running time. </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 3;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Mode.SampleTime</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Calculate how long does
it take for a method to run (including percentiles). </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 4;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Mode.SingleShotTime</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Just run a method once
(useful for cold-testing mode). Or more than once if you have specified a
batch size for your iterations (see </span><code><span style="font-family: Calibri; font-size: 10.0pt; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">@Measurement</span></code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">
annotation below) – in this case JMH will calculate the batch running time
(total time for all invocations in a batch). </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 5;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Any set of these modes</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">You can specify any set
of these modes – the test will be run several times (depending on number of
requested modes). </span></div>
</td>
</tr>
<tr style="mso-yfti-irow: 6; mso-yfti-lastrow: yes;">
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">Mode.All</span></div>
</td>
<td style="padding: .75pt .75pt .75pt .75pt;">
<div class="MsoNormal">
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-theme-font: major-latin;">All these modes one after
another. </span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081966">Time units</a></h2>
<span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">You can specify time unit to use via </span><code><b style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">@OutputTimeUnit</span></b></code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">, which requires an argument of the standard Java type </span><code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">java.util.concurrent.TimeUnit</span></code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">.
Unfortunately, if you have specified several test modes for one test, the given
time unit will be used for all tests (for example, it may be convenient to measure
</span><code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;">SampleTime</span></code><span style="font-family: Calibri; mso-ascii-theme-font: major-latin; mso-hansi-theme-font: major-latin;"> in nanoseconds, but throughput should better be measured in the
longer time units). </span><br />
<div class="MsoNormal">
<br /></div>
<h2>
<a href="https://www.blogger.com/null" name="_Toc263081967">Black Hole for Dead code result</a></h2>
Dead code elimination is a well known problem among microbenchmark writers.
The general solution is to use the result of calculations somehow. JMH does not
do any magic tricks on its own. If you want to defend against dead code
elimination – <strong><span style="font-family: Times;">never write </span></strong><code><b>void</b></code><strong><span style="font-family: Times;"> tests. Always return the result of your
calculations.</span></strong> JMH will take care of the rest. <br />
If you need to return more than one value from your test, either combine all
return values with some cheap operation (cheap compared to the cost of
operations by which you got your results) or use a <code>BlackHole</code>
method argument and sink all your results into it (note that <code>BlockHole.consume</code>
may be more expensive than manual combining of results in some cases). <code>BlackHole</code>
is a thread-scoped class.<br />
<br />
@GenerateMicroBenchmark(BenchmarkType.<i>All)</i><br />
<span style="mso-spacerun: yes;"> </span><b>public void
arrayListIterator(BlackHole bh) {</b><br />
<span style="mso-spacerun: yes;"> </span>Iterator<Integer>
iterator = arrayList.iterator();<br />
<span style="mso-spacerun: yes;"> </span><b>while(iterator.hasNext()) {</b><br />
<b><span style="mso-spacerun: yes;"> </span></b>Integer i =
iterator.next();<br />
<span style="mso-spacerun: yes;"> </span>bh.consume(i);<br />
<span style="mso-spacerun: yes;"> </span>}<br />
<span style="mso-spacerun: yes;"> </span>}<br />
<br />
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/15420849859256187745noreply@blogger.com0