Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jmh benchmark #89

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Jmh benchmark #89

wants to merge 2 commits into from

Conversation

fmcarvalho
Copy link
Contributor

To run spring-comparing-template-engines with JMH on you local machine just run:

mvn clean install

And then:

java -cp target\template-engines.jar;target\classes org.openjdk.jmh.Main -f 1 -r 5 -w 5 -i 4 -wi 4

NOTICE use : or; as classpath separator depending on whether you are in linux or windows.

There is an issue with maven-shade-plugin configured according to JMH that is not including this project's classes (com.jeroenreijn.examples) in the resulting jar, i.e. template-engines.jar. That's why I am providing the jar and the target\classes in classpath. Otherwise, it would be possible to run with java -jar target\template-engines.jar.

Usually I run JMH with -f 1 -r 5 -w 5 -i 4 -wi 4 which is fair enough to collect consistent results. Yet, you may change it accordingly:

  • -f - How many times to fork a single benchmark.
  • -r - Minimum time to spend at each measurement iteration in seconds.
  • -w - Minimum time to spend at each warmup iteration in seconds
  • -i - Number of measurement iterations
  • -wi - Number of warmup iterations

NOTICE We have here 18 templates correctly measured, missing only JSP which does not produce HTML output because Spring MVC Test doesn't run that servlet container (https://stackoverflow.com/a/37749746/1140754)

Next, you have the results collected in my machine (Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz, Windows 10 Pro, JDK 17.0.2, Java HotSpot(TM) 64-Bit Server VM):

Benchmark                        Mode  Cnt      Score       Error  Units
LaunchJMH.benchmarkChunk        thrpt    4   7005,888 ±   662,273  ops/s
LaunchJMH.benchmarkFreemarker   thrpt    4   7874,883 ±   531,991  ops/s
LaunchJMH.benchmarkGroovy       thrpt    4     10,680 ±    14,304  ops/s
LaunchJMH.benchmarkHandlebars   thrpt    4    515,719 ±    62,625  ops/s
LaunchJMH.benchmarkHtmlFlow     thrpt    4  18042,021 ±  8619,886  ops/s
LaunchJMH.benchmarkHttl         thrpt    4   1347,726 ±  1252,651  ops/s
LaunchJMH.benchmarkIckenham     thrpt    4   2996,950 ±   682,017  ops/s
LaunchJMH.benchmarkJade         thrpt    4     72,926 ±    12,907  ops/s
LaunchJMH.benchmarkJsp          thrpt    4  32665,717 ± 29053,124  ops/s
LaunchJMH.benchmarkKotlinxHtml  thrpt    4  13283,696 ±  1150,034  ops/s
LaunchJMH.benchmarkLiqp         thrpt    4   1588,033 ±    83,760  ops/s
LaunchJMH.benchmarkMustache     thrpt    4   4331,608 ±   231,817  ops/s
LaunchJMH.benchmarkPebble       thrpt    4   2192,795 ±    80,917  ops/s
LaunchJMH.benchmarkRocker       thrpt    4  16590,245 ±   987,612  ops/s
LaunchJMH.benchmarkRythm        thrpt    4   7196,728 ±   403,504  ops/s
LaunchJMH.benchmarkScalate      thrpt    4    702,525 ±   348,521  ops/s
LaunchJMH.benchmarkThymeleaf    thrpt    4   1714,108 ±   184,021  ops/s
LaunchJMH.benchmarkTrimou       thrpt    4   9303,166 ±  1352,217  ops/s
LaunchJMH.benchmarkVelocity     thrpt    4   1645,852 ±   169,948  ops/s

@jreijn jreijn self-assigned this Nov 8, 2022
@fmcarvalho
Copy link
Contributor Author

@jreijn Any update about this?

@fmcarvalho
Copy link
Contributor Author

@jreijn Any news about this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants