Giter Club home page Giter Club logo

spring-comparing-template-engines's Introduction

Comparing Template engines for Spring MVC

Build Status

This is a demo project, which accompanied my "Shoot-out! Template engines for the JVM" presentation, which shows the differences among several Java template engines in combination with Spring MVC. Template engines used in this project are:

Build and run

You need Java 8 and Maven 3 to build and run this project. Build the project with

mvn package

Run the project with

mvn spring-boot:run

See the demo URLs:

Benchmarking

In case you want to benchmark the different template engines I would recommend using Apache HTTP server benchmarking tool or Siege an HTTP/HTTPS stress tester. You can try any of the following URLs.

$ ab -n 10000 -c 10 http://localhost:8080/jsp
$ ab -n 10000 -c 10 http://localhost:8080/velocity
$ ab -n 10000 -c 10 http://localhost:8080/freemarker
$ ab -n 10000 -c 10 http://localhost:8080/thymeleaf
$ ab -n 10000 -c 10 http://localhost:8080/mustache
$ ab -n 10000 -c 10 http://localhost:8080/jade
$ ab -n 10000 -c 10 http://localhost:8080/pebble
$ ab -n 10000 -c 10 http://localhost:8080/handlebars
$ ab -n 10000 -c 10 http://localhost:8080/scalate
$ ab -n 10000 -c 10 http://localhost:8080/httl
$ ab -n 10000 -c 10 http://localhost:8080/chunk
$ ab -n 10000 -c 10 http://localhost:8080/htmlFlow
$ ab -n 10000 -c 10 http://localhost:8080/trimou
$ ab -n 10000 -c 10 http://localhost:8080/rocker
$ ab -n 10000 -c 10 http://localhost:8080/ickenham
$ ab -n 10000 -c 10 http://localhost:8080/rythm
$ ab -n 10000 -c 10 http://localhost:8080/groovy
$ ab -n 10000 -c 10 http://localhost:8080/liqp
$ ab -n 10000 -c 10 http://localhost:8080/kotlinx

For creating the below benchmark results I used ApacheBench (version 2.4.25) with the following settings:

ab -n 25000 -c 25 -k http://localhost:8080/jsp

With 25 concurrent requests and 25.000 requests in total this resulted in the following numbers:

Benchmarks 2018

These tests were done on a local machine with the following specs:

Spring-Boot: 2.1.2.RELEASE
Windows 10 (1803, build: 17134.523)
3,60 GHz Intel Core i5-8350U Quad core
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
Apache Tomcat 9.0.14

Results in order (high to low):

Total time taken for processing 25.000 requests with a concurrency level of 25 (lower is better).

Jade4j                  567.7   seconds
Handlebars              147.7   seconds
Scalate - Scaml          33.33  seconds
Pebble                   27.92  seconds
HTTL                     24.61  seconds
Thymeleaf                24.09  seconds
Velocity                 23.07  seconds
Freemarker               11.80  seconds
jTwig                    10.95  seconds
Mustache (JMustache)      8.836 seconds
JSP                       7.888 seconds

Benchmarks 10.2019

These tests were done on a local machine with the following specs:

Spring-Boot: 2.1.4.RELEASE
Windows 10 (1803, build: 17134.706)
3,60 GHz Intel Core i5-8350U Quad core
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
Apache Tomcat 9.0.17

Results in order (high to low):

Total time taken for processing 25.000 requests with a concurrency level of 25. (lower is better)

Groovy                  ~ 800    seconds
Jade4j                    684.7  seconds
Handlebars                161.8  seconds
Scalate - Scaml            34.38 seconds
Velocity                   27.49 seconds
Pebble                     25.63 seconds
HTTL                       22.86 seconds
jTwig                      21.23 seconds
Liqp                       19.60 seconds
Ickenham                   19.50 seconds
Thymeleaf                  18.33 seconds
Rythm                      17.84 seconds
Rocker                     17.63 seconds
Mustache (JMustache)       15.75 seconds
HtmlFlow                   15.62 seconds
Chunk                      15.04 seconds
Trimou                     15.02 seconds
Freemarker                 14.74 seconds
JSP                        11.22 seconds

Keep in mind that in the real world, these results will differ depending on the complexity of the templates, hardware, etc, so it's just an indication and if you want to know the truth you will have to run the benchmark yourself to see how such a template engine performs in your specific environment.

Chunk produces pages with variable length. I haven't investigated it yet. ab might fail, and for Chunk use:

$ ab -n 25000 -c 25 -l http://localhost:8080/chunk

How were the results measured?

Before the performance of each template engines was measured, there were at least 2 dry runs with the exact same settings, to make sure that initialization of the engines, warm up of the JVM and additional caches have taken place. There were at least 5 iterations of the same benchmark before calculating the average time it took.

For Mac OS X users

Mac OS X has only 16K ports available that won't be released until socket TIME_WAIT is passed. The default timeout for TIME_WAIT is 15 seconds. Consider reducing in case of available port bottleneck.

You can check whether this is a problem with netstat:

# sysctl net.inet.tcp.msl
net.inet.tcp.msl: 15000

Now if you want to change this you can do so by doing:

# sudo sysctl -w net.inet.tcp.msl=1000
net.inet.tcp.msl: 15000 -> 1000

In case you still run into problem you might want to read this thread on ephemeral ports.

Contributing

In case you see an improvement to the benchmark or know about ways to improve the results, please file an issue and send a pull request.

spring-comparing-template-engines's People

Contributors

dependabot[bot] avatar fmcarvalho avatar greenlaw110 avatar jknack avatar jmelo-lyncode avatar joshiste avatar jreijn avatar shooksm avatar vest avatar wmanley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-comparing-template-engines's Issues

Thymeleaf 2.1.2 / 2.1.4 performance is MUCH better

Thanks for this project, great resource!

(ProductName: Mac OS X
ProductVersion: 10.10.1
BuildVersion: 14B25,
sudo sysctl net.inet.tcp.msl=1000)

The Thymeleaf 2.1.2 first run gives me 13.7s, second 8.5s, the third 6.6s.
The Thymeleaf 2.1.4 first run gives me 14.1s, second 6.5s, the third 7.6s.
The JSP test on the first run gives 7s, second run 6s, third run 6.3s.

However I test I cannot match that extreme difference that you've experienced between JSP and Thymeleaf.

The reason I was holding back from using Thymeleaf was your tests but looks like the performance isn't really an issue. Can you double check maybe?

n=10000 c=10
---------------------------------------------------------
Document Path:          /jsp
Document Length:        8506 bytes

Concurrency Level:      10
Time taken for tests:   6.691 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      87440000 bytes
HTML transferred:       85060000 bytes
Requests per second:    1494.53 [#/sec] (mean)
Time per request:       6.691 [ms] (mean)
Time per request:       0.669 [ms] (mean, across all concurrent requests)
Transfer rate:          12761.92 [Kbytes/sec] received
---------------------------------------------------------
Document Path:          /thymeleaf
Document Length:        8856 bytes

Concurrency Level:      10
Time taken for tests:   6.482 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      90190000 bytes
HTML transferred:       88560000 bytes
Requests per second:    1542.75 [#/sec] (mean)
Time per request:       6.482 [ms] (mean)
Time per request:       0.648 [ms] (mean, across all concurrent requests)
Transfer rate:          13587.92 [Kbytes/sec] received
n=25000 c=25
---------------------------------------------------------
Document Path:          /jsp
Document Length:        8506 bytes

Concurrency Level:      25
Time taken for tests:   17.993 seconds
Complete requests:      25000
Failed requests:        0
Total transferred:      218600000 bytes
HTML transferred:       212650000 bytes
Requests per second:    1389.42 [#/sec] (mean)
Time per request:       17.993 [ms] (mean)
Time per request:       0.720 [ms] (mean, across all concurrent requests)
Transfer rate:          11864.32 [Kbytes/sec] received

---------------------------------------------------------
Document Path:          /thymeleaf
Document Length:        8856 bytes

Concurrency Level:      25
Time taken for tests:   19.339 seconds
Complete requests:      25000
Failed requests:        0
Total transferred:      225475000 bytes
HTML transferred:       221400000 bytes
Requests per second:    1292.71 [#/sec] (mean)
Time per request:       19.339 [ms] (mean)
Time per request:       0.774 [ms] (mean, across all concurrent requests)
Transfer rate:          11385.69 [Kbytes/sec] received

URL context path

Hi,
I have read with interest the results of your tests, thanks.

I installed the web app as a war /template-engines and noticed that only thymeleaf adds the context path to the script/css URL(s), the others do not.

Global cache flag: Should have a two runs with cache enabled and cache disabled.

There is a fundamental problem with this benchmark in that it is testing the compiling AND execution on every request for many of the libraries. Some of them that isn't the case which is also rather unfair (For example JSP only compiles once so long as the file does not change where as Handlebars compiles on every request when setCache(false)).

There are two phases in most templating languages.

  • Compiling - when the templates are turned into ASTs or bytecode etc
  • Executing - a model is then passed to the compiled template and run

In a production setting compiling only happens once.

Thus most folks are truly only concerned with how fast the templates execute and not compile and then execute.

Furthermore I believe there are templating languages that are probably doing some internal caching similar to how JSP is only compiling once.

Anyway my recommendation is to make some global property that enables cache for all the template engines.

Then you can test both scenarios.

Is spring mvc (spring boot + tomcat) too slow?

Hi guys,

the last few days i have tested the following benchmarks intensively:

the results highly surprised me. Yes htmlFlow and Rocker are the champions.

But look the thymeleaf results: in template-benchmark is very slow but in spring-comparing-template-engines good enough. Why make it possibly?

I think now that spring (or the layer apache tomcat + spring boot) make everything slow and the end thoughtput IS TOO SLOW as well, and makes Thymeleaf "not bad"??

What do you think about?

Add kotlinx.html

kotlinx.html library provides DSL for building HTML pages. Since kotlin is inter-operable with Java we can easily integrate kotlinx.html based views in this project.

Pull request #60 solves this issue.

kotlinx.html shares many of the HtmlFlow properties and it is interesting to compare performance between them.

Add HtmlFlow

HtmlFlow is a Java DSL to write typesafe HTML documents.

HtmlFlow is at least two fold faster than the current best template engine in spring-comparing-template-engines.

HtmlFlow is widely used to build dynamic HTML documents, such as papers, reports, emails, etc, involving complex programing tasks which are hardly achieved through textual templates. Moreover, HtmlFlow can also be used as a web template engine allying its performance boost with its HTML strongly type safety characteristics.

Dependency org.yaml:snakeyaml, leading to CVE problem

Hi, In /,there is a dependency org.yaml:snakeyaml:1.30 that calls the risk method.

CVE-2022-25857

The scope of this CVE affected version is [0,1.31)

After further analysis, in this project, the main Api called is org.yaml.snakeyaml.composer.Composer: composeNode(org.yaml.snakeyaml.nodes.Node)Lorg.yaml.snakeyaml.nodes.Node;

Risk method repair link : GitHub

CVE Bug Invocation Path--

Path Length : 5

CVE Bug Invocation Path : 
com.jeroenreijn.examples.view.KotlinxHtmlIndexView$Companion: presentationsTemplate(java.lang.Iterable)Ljava.lang.String; /.m2/repository/org/eclipse/jdt/ecj/3.18.0/ecj-3.18.0.jar
org.yaml.snakeyaml.Yaml$1: next()Ljava.lang.Object; /.m2/repository/org/eclipse/jdt/ecj/3.18.0/ecj-3.18.0.jar
org.yaml.snakeyaml.constructor.BaseConstructor: getData()Ljava.lang.Object; /.m2/repository/org/eclipse/jdt/ecj/3.18.0/ecj-3.18.0.jar
org.yaml.snakeyaml.composer.Composer: getNode()Lorg.yaml.snakeyaml.nodes.Node; /.m2/repository/org/eclipse/jdt/ecj/3.18.0/ecj-3.18.0.jar
org.yaml.snakeyaml.composer.Composer: composeNode(org.yaml.snakeyaml.nodes.Node)Lorg.yaml.snakeyaml.nodes.Node;

Dependency tree--

[INFO] com.jeroenreijn:spring-comparing-template-engines:war:0.9.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.7.5:compile
[INFO] |  \- org.springframework.boot:spring-boot:jar:2.7.5:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.7.5:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.7.5:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.7.5:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.30:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.7.5:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4.2:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.13.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.13.4:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.23:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.23:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.23:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.23:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.7.5:compile
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.68:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.68:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.68:compile
[INFO] +- org.springframework:spring-context-support:jar:5.3.23:compile
[INFO] |  +- org.springframework:spring-beans:jar:5.3.23:compile
[INFO] |  +- org.springframework:spring-context:jar:5.3.23:compile
[INFO] |  \- org.springframework:spring-core:jar:5.3.23:compile
[INFO] |     \- org.springframework:spring-jcl:jar:5.3.23:compile
[INFO] +- org.webjars:bootstrap:jar:5.2.3:compile
[INFO] +- org.apache.tomcat.embed:tomcat-embed-jasper:jar:9.0.68:provided
[INFO] |  \- org.eclipse.jdt:ecj:jar:3.18.0:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:2.7.5:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring5:jar:3.0.11.RELEASE:compile
[INFO] |  |  \- org.thymeleaf:thymeleaf:jar:3.0.11.RELEASE:compile
[INFO] |  |     \- org.attoparser:attoparser:jar:2.0.5.RELEASE:compile
[INFO] |  \- org.thymeleaf.extras:thymeleaf-extras-java8time:jar:3.0.4.RELEASE:compile
[INFO] +- org.ow2.asm:asm-xml:jar:6.2.1:compile
[INFO] |  +- org.ow2.asm:asm:jar:6.2.1:compile
[INFO] |  \- org.ow2.asm:asm-util:jar:6.2.1:compile
[INFO] |     +- org.ow2.asm:asm-tree:jar:6.2.1:compile
[INFO] |     \- org.ow2.asm:asm-analysis:jar:6.2.1:compile
[INFO] +- com.github.jknack:handlebars-springmvc:jar:4.3.1:compile
[INFO] |  \- com.github.jknack:handlebars:jar:4.3.1:compile
[INFO] +- com.x5dev:chunk-templates:jar:3.6.2:compile
[INFO] +- com.x5dev:chunk-springmvc:jar:0.1.0:compile
[INFO] +- org.freemarker:freemarker:jar:2.3.28:compile
[INFO] +- com.github.httl:httl-springmvc:jar:1.0.11:compile
[INFO] |  \- com.github.httl:httl:jar:1.0.11:compile
[INFO] +- org.apache.velocity:velocity-engine-core:jar:2.0:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] +- org.apache.velocity.tools:velocity-tools-view:jar:3.0:compile
[INFO] |  +- org.apache.velocity.tools:velocity-tools-generic:jar:3.0:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] |  |  \- com.github.cliftonlabs:json-simple:jar:3.0.2:compile
[INFO] |  \- org.apache.commons:commons-digester3:jar:3.2:compile
[INFO] |     +- cglib:cglib:jar:2.2.2:compile
[INFO] |     |  \- asm:asm:jar:3.3.1:compile
[INFO] |     \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- com.alibaba.boot:velocity-spring-boot-starter:jar:1.0.4.RELEASE:compile
[INFO] |  \- com.alibaba.boot:velocity-spring-boot-autoconfigure:jar:1.0.4.RELEASE:compile
[INFO] |     +- com.alibaba.spring:spring-context-velocity:jar:1.4.3.18.RELEASE:compile
[INFO] |     +- com.alibaba.spring:spring-webmvc-velocity:jar:1.4.3.18.RELEASE:compile
[INFO] |     +- com.alibaba.boot:spring-boot-web-support:jar:1.0.0.RELEASE:compile
[INFO] |     |  \- com.alibaba.spring:spring-webmvc-support:jar:1.0.0.RELEASE:compile
[INFO] |     |     \- com.alibaba.spring:spring-context-support:jar:1.0.0.RELEASE:compile
[INFO] |     +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] |     |  \- commons-lang:commons-lang:jar:2.4:compile
[INFO] |     \- org.apache.velocity:velocity-tools:jar:2.0:compile
[INFO] |        +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |        +- commons-chain:commons-chain:jar:1.1:compile
[INFO] |        +- commons-validator:commons-validator:jar:1.3.1:compile
[INFO] |        +- dom4j:dom4j:jar:1.1:compile
[INFO] |        +- oro:oro:jar:2.0.8:compile
[INFO] |        \- sslext:sslext:jar:1.2-0:compile
[INFO] +- de.neuland-bfi:spring-jade4j:jar:1.3.1:compile
[INFO] |  +- de.neuland-bfi:jade4j:jar:1.3.1:compile
[INFO] |  |  +- org.apache.commons:commons-jexl:jar:2.1.1:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  |  +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.4.2:compile
[INFO] |  |  \- com.vladsch.flexmark:flexmark:jar:0.42.14:compile
[INFO] |  |     \- com.vladsch.flexmark:flexmark-util:jar:0.42.14:compile
[INFO] |  \- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mustache:jar:2.7.5:compile
[INFO] |  \- com.samskivert:jmustache:jar:1.15:compile
[INFO] +- io.pebbletemplates:pebble:jar:3.1.6:compile
[INFO] |  \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] +- io.pebbletemplates:pebble-spring-boot-starter:jar:3.1.6:compile
[INFO] |  \- io.pebbletemplates:pebble-spring5:jar:3.1.6:compile
[INFO] +- org.scalatra.scalate:scalate-core_2.13:jar:1.9.8:compile
[INFO] |  +- org.scala-lang:scala-compiler:jar:2.13.8:compile
[INFO] |  |  +- org.scala-lang:scala-reflect:jar:2.13.8:compile
[INFO] |  |  +- org.jline:jline:jar:3.21.0:compile
[INFO] |  |  \- net.java.dev.jna:jna:jar:5.9.0:compile
[INFO] |  +- org.scala-lang:scala-library:jar:2.13.8:compile
[INFO] |  \- org.scalatra.scalate:scalate-util_2.13:jar:1.9.8:compile
[INFO] |     +- org.scala-lang.modules:scala-parser-combinators_2.13:jar:2.1.1:compile
[INFO] |     \- org.scala-lang.modules:scala-xml_2.13:jar:2.0.1:compile
[INFO] +- org.scalatra.scalate:scalate-spring-mvc_2.13:jar:1.9.8:compile
[INFO] +- com.github.xmlet:htmlflow:jar:4.0:compile
[INFO] |  +- org.slf4j:slf4j-simple:jar:1.7.36:compile
[INFO] |  +- com.github.xmlet:htmlApiFaster:jar:1.0.12:compile
[INFO] |  |  +- com.github.xmlet:xsdAsmFaster:jar:1.0.10:compile
[INFO] |  |  |  +- org.ow2.asm:asm-parent:pom:6.0:compile
[INFO] |  |  |  +- org.ow2.asm:asm-commons:jar:6.0:compile
[INFO] |  |  |  \- com.github.xmlet:xsdParser:jar:1.0.13:compile
[INFO] |  |  |     \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  |  +- org.jboss.windup.decompiler:decompiler-fernflower:jar:4.0.0.Final:compile
[INFO] |  |  |  +- org.jboss.windup.decompiler.fernflower:windup-fernflower:jar:1.0.0.20171018:compile
[INFO] |  |  |  +- org.jboss.windup.decompiler:decompiler-api:jar:forge-addon:4.0.0.Final:compile
[INFO] |  |  |  \- org.jboss.windup.utils:windup-utils:jar:forge-addon:4.0.0.Final:compile
[INFO] |  |  |     +- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] |  |  |     \- com.google.guava:guava:jar:18.0:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
[INFO] |  \- org.jsoup:jsoup:jar:1.15.3:compile
[INFO] +- org.trimou:trimou-core:jar:2.5.1.Final:compile
[INFO] +- com.fizzed:rocker-runtime:jar:1.3.0:compile
[INFO] +- com.github.enpassant:ickenham-spring-mvc_2.13:jar:1.5.0:compile
[INFO] |  \- com.github.enpassant:ickenham_2.13:jar:1.5.0:compile
[INFO] +- org.rythmengine:rythm-engine:jar:1.4.1:compile
[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:4.6.1:compile
[INFO] |  +- com.stevesoft.pat:pat:jar:1.5.3:compile
[INFO] |  +- com.alibaba:fastjson:jar:1.2.75:compile
[INFO] |  +- org.mvel:mvel2:jar:2.4.12.Final:compile
[INFO] |  +- org.mockito:mockito-core:jar:4.5.1:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.18:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.18:compile
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:runtime
[INFO] |  +- org.osgl:osgl-version:jar:2.0.0-BETA-4-JAVA7:compile
[INFO] |  \- org.osgl:osgl-ut:jar:2.0.0-BETA-4-JAVA7:compile
[INFO] |     \- org.hamcrest:hamcrest-junit:jar:2.0.0.0:compile
[INFO] |        \- org.hamcrest:java-hamcrest:jar:2.0.0.0:compile
[INFO] +- org.rythmengine:spring-rythm:jar:1.2.2:compile
[INFO] |  +- org.osgl:osgl-mvc:jar:1.5.1:compile
[INFO] |  |  +- org.osgl:osgl-tool:jar:1.7.0:compile
[INFO] |  |  \- org.osgl:osgl-http:jar:1.4.0:compile
[INFO] |  |     \- org.osgl:osgl-cache:jar:1.1.0:compile
[INFO] |  +- org.osgl:osgl-logging:jar:1.1.0:compile
[INFO] |  +- org.osgl:osgl-storage:jar:1.5.0:compile
[INFO] |  \- junit:junit:jar:4.13.2:compile
[INFO] |     \- org.hamcrest:hamcrest-core:jar:2.2:compile
[INFO] +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.7.20:compile
[INFO] |  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.7.20:compile
[INFO] |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO] +- org.jetbrains.kotlinx:kotlinx-html-jvm:jar:0.8.0:compile
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.7.20:runtime
[INFO] |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.7.20:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-groovy-templates:jar:2.7.5:compile
[INFO] |  \- org.codehaus.groovy:groovy-templates:jar:3.0.13:compile
[INFO] |     +- org.codehaus.groovy:groovy:jar:3.0.13:compile
[INFO] |     \- org.codehaus.groovy:groovy-xml:jar:3.0.13:runtime
[INFO] +- nl.big-o:liqp:jar:0.8.5.1:compile
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:2.7.5:test
[INFO]    +- org.springframework.boot:spring-boot-test:jar:2.7.5:test
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.7.5:test
[INFO]    +- com.jayway.jsonpath:json-path:jar:2.7.0:test
[INFO]    |  \- net.minidev:json-smart:jar:2.4.8:test
[INFO]    |     \- net.minidev:accessors-smart:jar:2.4.8:test
[INFO]    +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO]    |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO]    +- org.assertj:assertj-core:jar:3.22.0:test
[INFO]    +- org.hamcrest:hamcrest:jar:2.2:test
[INFO]    +- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO]    |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO]    |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO]    |  |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO]    |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO]    |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO]    |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO]    |     \- org.junit.platform:junit-platform-engine:jar:1.8.2:test
[INFO]    +- org.mockito:mockito-junit-jupiter:jar:4.5.1:test
[INFO]    +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO]    |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO]    +- org.springframework:spring-test:jar:5.3.23:test
[INFO]    \- org.xmlunit:xmlunit-core:jar:2.9.0:test

Suggested solutions:

Update dependency version

Thank you very much.

Should we use caching, or disable it

Hello everyone,

In the commit e090f2b I turned the View caching on. I did this, because some of viewResolvers had it enabled. I think this should affect the benchmark results.
Here I decided to ask the community, whether the caching should be disabled, or not. What do you think about this?

Kind regards,
Vest

Add Rythm to Benchmark

I'd be interested to see how Rythm stacks up since it is strongly typed and get compiled to byte code. The website claims it is faster than velocity.

Update the project to Tomcat 8 and Java 8

Hello,

I have found out that Tomcat 7 is not popular anymore, and people are slowly moving towards Java 8. What do you think about updating the solution to support Tomcat 8 and drop :) frameworks who do not support it.

Kind regards

Upgrade HtmlFlow to release 3.5

We have fixed some issues on latest releases of HtmlFlow that were preventing the use of HtmlFlow in its entire plenitude within spring-comparing-template-engines. The #56 includes the following updates:

  • Fixed a problem where the block html was written two times into the response. Reported by @Vest at #34 (comment)
  • Updated the HtmlFlowIndexView according to the new behavior of HtmlFlow in version 3.3. (https://github.com/xmlet/HtmlFlow#33-august-2019) where it: ”disallows the use of chained calls to dynamic() due to unexpected cache behaviors.”. Thus we had to replace the inner invocations of dynamic() by of().
  • Changed the static method getView() of HtmlFlowIndexView with a static field view.
  • Added the threadSafe() initialization to the previous view to enable safe use on concurrent benchmarks.

Improving Thymeleaf results

At first sight, there are a couple of modifications you can do in order to improve your Thymeleaf results.

  • The first time it is executed, Thymeleaf needs to perform a good amount of initializations. Question: It is not clear from your README... are you first executing some un-benchmarked requests against your URLs in order to allow it to initialize?
  • Executing not only one request, but in fact a number of them, will also help the JVM to warm up and compile some methods into native and enhance your results. For example, these are the results with your same ab -n 10000 -c 4 command in three subsequent executions against the thymeleaf URL:
Time taken for tests:   10.756 seconds
Time taken for tests:   8.159 seconds
Time taken for tests:   5.394 seconds
  • I see you include the ConditionalCommentsDialect dialect into your template engine, even if it isn't needed (your templates do not include conditional comments). This dialect actually reduces a bit the performace of Thymeleaf, because in order to execute it needs not only to check element (i.e. tag) nodes for processors, but also text and comment nodes. And there are a lot of text comments in templates. So removing this dialect if you don't need it should improve a bit your performance.

Thanks for the figures! I will tell you if I find further points of improvement.

JSP context path with c:url

Hi,
I saw that context path has been added to all engines, great work !

one thing: I believe the standard way to provide context path in JSP is using c:url tag while now the template uses strings concatenation. So for example instead of

   <link rel="stylesheet" href="${root}/webjars/bootstrap/3.0.1/css/bootstrap.min.css" media="screen">

the code would be:

   <link rel="stylesheet" href="<c:url value='/webjars/bootstrap/3.0.1/css/bootstrap.min.css'/>" media="screen">

or, if HTML escaping is needed (normally should be done, but not sure what happens in other templates/tests):

  <c:url var='linkUrl' value='/webjars/bootstrap/3.0.1/css/bootstrap.min.css'/>
  <link rel="stylesheet" href="<c:out value='${linkUrl}'/>" media="screen">

BTW any change in performance after the "context path" change ?
Thanks,
Bye

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.