???JMH???????????
???????????? ???????[ 2016/6/16 15:06:51 ] ??????????????? ??????? JMH
???????????
??????benchmark???????????????????benchmark???????benchmark????microbenchmark????????????????????
?????????benchmark???????棬???????????web?????????????????????????????????罻???????????????benchmark??microbenchmark????????????С??????????????????java????microbenchmark??????????????????microbenchmark?????web????????microbenchmark????
????????java?????microbenchmark????浽???java????????????benchmark???????????????java??????????????????????Σ????JIT????????Ч????????????????????????????????ó???????????????????????????jvm??????????????????????
????????????????????????????????JIT?????????????????????????????ó????????????Σ??????????????????????????????JMH??codetool???????java???????microbenchmark?????????
????????????
????1??jmh
????JMH(JavaMicro-benchmarksHarnessorJuicyMunchyHummus??hardtosayastheydon'ttellyouonthesite)isthelatestandasitcomesoutoftheworkshopoftheverypeoplewhoworkhardtomaketheOpenJDKJVMflyitpromisestodelivermoreaccuracyand
bettertoolingthenmost.
????2????÷??
??????1??????maven??????
????<dependency>
????<groupId>org.openjdk.jmh</groupId>
????<artifactId>jmh-core</artifactId>
????<version>0.4.2</version>
????</dependency>
??????2??HELLOWORLD
????publicclassJMHSample_01_HelloWorld{
????@GenerateMicroBenchmark
????publicvoidwellHelloThere(){
???? //thismethodwasintentionallyleftblank.
???? }
????}
??????3????????????
????mvncleaninstall
????java-jartarget/benchmarks.jarJMHSample_01`
??????4??main???????????
????publicstaticvoidmain(String[]args)throwsRunnerException{
???? Optionsopt=newOptionsBuilder()
???? .include(JMHSample_01_HelloWorld.class.getSimpleName())
???? .forks(1)
???? .build();
???? newRunner(opt).run();
????}
???????????????
????1??Mode.Throughput
?????????????????????÷??????????????
????2??Mode.AverageTime
?????????????????
????3??Mode.SampleTime
?????????????????в???????
????4??Mode.SingleShotTime
????????????ε??????/??????????????????
????????
??????@State??????????????????????????????JMH??????????????????
???????????????????????????????????????????????з????????????????????????????????????????????????????e???????÷???????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11