Closed adam-ah closed 7 years ago
Hi @adam-ho ,
yes you are probably right. In my case I did the benchmark on a Core 2 Duo machine. What are you hardware specs? Thymeleaf is quite CPU bound, so the more CPU power the faster it is.
I'm working on improving this information, so I will also update the example project. Next to that I want to create a seperate git repo for benchmarking only the template engines (so without the Spring part) with JMH.
Jeroen
Hi Jeroen,
It's an i7 dual core. As it's all local environment without IO access, all tests must be CPU bound; both JSP and Thymeleaf. That still doesn't explain why you had that enormous performance difference between JSP and Thymeleaf; however it can be deterring for people looking into Thymeleaf as it looks like it's actually unusably slow compared to JSP or Freemarker. But that's not really the case... (note: I haven't worked much with Thymeleaf either).
Thanks,
Adam
Hmm, it's indeed strange, but any concurrent test I perform shows about the same numbers. On my current machine (Quad core i7), I get these numbers:
$ ab -n 25000 -c 25 -k http://127.0.0.1:8080/jsp
Document Path: /jsp
Document Length: 8506 bytes
Concurrency Level: 25
Time taken for tests: 1.832 seconds
Complete requests: 25000
Failed requests: 0
Keep-Alive requests: 0
Total transferred: 218600000 bytes
HTML transferred: 212650000 bytes
Requests per second: 13643.15 [#/sec] (mean)
Time per request: 1.832 [ms] (mean)
Time per request: 0.073 [ms] (mean, across all concurrent requests)
Transfer rate: 116499.67 [Kbytes/sec] received
$ ab -n 25000 -c 25 -k http://127.0.0.1:8080/thymeleaf
Document Path: /thymeleaf
Document Length: 8856 bytes
Concurrency Level: 25
Time taken for tests: 3.600 seconds
Complete requests: 25000
Failed requests: 0
Keep-Alive requests: 0
Total transferred: 225475000 bytes
HTML transferred: 221400000 bytes
Requests per second: 6945.24 [#/sec] (mean)
Time per request: 3.600 [ms] (mean)
Time per request: 0.144 [ms] (mean, across all concurrent requests)
Transfer rate: 61171.03 [Kbytes/sec] received
openSUSE 13.2 Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz JSP
Document Path: /jsp
Document Length: 8506 bytes
Concurrency Level: 25
Time taken for tests: 7.896 seconds
Complete requests: 25000
Failed requests: 0
Keep-Alive requests: 0
Total transferred: 218600000 bytes
HTML transferred: 212650000 bytes
Requests per second: 3166.22 [#/sec] (mean)
Time per request: 7.896 [ms] (mean)
Time per request: 0.316 [ms] (mean, across all concurrent requests)
Transfer rate: 27036.54 [Kbytes/sec] received
THYMELEAF
Document Path: /thymeleaf
Document Length: 8856 bytes
Concurrency Level: 25
Time taken for tests: 9.406 seconds
Complete requests: 25000
Failed requests: 0
Keep-Alive requests: 0
Total transferred: 225475000 bytes
HTML transferred: 221400000 bytes
Requests per second: 2658.02 [#/sec] (mean)
Time per request: 9.406 [ms] (mean)
Time per request: 0.376 [ms] (mean, across all concurrent requests)
Transfer rate: 23410.79 [Kbytes/sec] received
This is still interesting. I think I will try this out on a linux box to see if that makes any difference.
This issue is probably not relevant anymore, because we have Thymeleaf 3 (see #20).
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?