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

Merge works of all other forks #19

Open
wants to merge 101 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
81972fc
First commit
baryshev Sep 16, 2012
c96939a
Update README.md
baryshev Sep 16, 2012
caac515
Update ECT version
baryshev Sep 16, 2012
d68ab0a
Update ECT version
baryshev Sep 16, 2012
69763e8
Add hogan, update ECT version
baryshev Sep 16, 2012
9364467
Update ECT version
baryshev Sep 17, 2012
16bdd4d
Fix time measurement
baryshev Sep 17, 2012
3a1cad3
Add dust support
baryshev Sep 17, 2012
168f20d
patch dust.js test
norlin Sep 17, 2012
147a9d9
Merge pull request #1 from norlin/master
baryshev Sep 17, 2012
511aaf3
Added Dest, doT. Added unescaped benchmark.
baryshev Sep 23, 2012
7c2cbad
Added Dest, doT.
baryshev Sep 23, 2012
57cc9a7
Added Handlebars.js. Added total metric.
baryshev Sep 23, 2012
d68c5bc
Benchmark update
baryshev Oct 5, 2012
b44bf37
Fix Jade test
baryshev Oct 8, 2012
0096460
Add jade without
baryshev Oct 14, 2012
7283858
Benchmark update
baryshev Nov 14, 2012
e3c63ac
add ejs without with test
zxcabs Dec 5, 2012
f08cc8a
Merge pull request #2 from zxcabs/ejs-without-with
baryshev Dec 5, 2012
9464693
Fix typo
baryshev Dec 5, 2012
04e2e85
Sort by total
baryshev Dec 5, 2012
44930b5
Add CoffeeKup template engine
baryshev Dec 6, 2012
1436a3c
Merge branch 'master' of github.com:baryshev/template-benchmark
baryshev Dec 6, 2012
13bd09e
Add CoffeeKup template engine
baryshev Dec 6, 2012
e3341b7
Update README.md
baryshev Dec 6, 2012
9c1cf00
Update Jade templates
baryshev Dec 11, 2012
34cb3bd
Merge branch 'master' of github.com:baryshev/template-benchmark
baryshev Dec 11, 2012
063c13d
Update ECT version
baryshev Dec 11, 2012
26ad5b4
Update README.md
baryshev Dec 11, 2012
2557dd8
Update ECT version
baryshev Dec 16, 2012
f87812c
Update README.md
baryshev Dec 16, 2012
89c95a2
Update ECT and Swig versions
baryshev Dec 23, 2012
a7d8ae5
Add Underscore benchmark
baryshev Dec 26, 2012
af2838d
Added Gaikan 1.2.1 benchmark.
Feb 20, 2013
3a7152e
Merge pull request #5 from Deathspike/master
baryshev Feb 23, 2013
30efe89
Update engine versions
baryshev Feb 23, 2013
beb66d3
Gaikan 1.3.3. Corrected terrible mistake in HTML.
Feb 23, 2013
4b13c0d
Merge pull request #7 from Deathspike/master
baryshev Feb 23, 2013
f99044e
Update results
baryshev Feb 23, 2013
96c347e
Gaikan 1.3.4. Use optimized data-for iterator.
Feb 24, 2013
b55d7ca
Merge pull request #8 from Deathspike/master
baryshev Mar 2, 2013
44859ea
Upgrade Gaikan to 1.3.4, Results for node v.0.8.21
baryshev Mar 2, 2013
1682f4f
Upgrage ECT to 0.4.8
baryshev Mar 2, 2013
511081c
use the release version
spullara Feb 25, 2015
dee753c
use the latest version
spullara Feb 25, 2015
7537d52
add indy based benchmark
spullara Feb 25, 2015
e5fca7f
turn off HTML encoding as per the specification for the benchmark
spullara Feb 27, 2015
516e8c1
Added moshas.
kawasima Oct 20, 2015
4840890
Add Twirl
lauraluiz Nov 15, 2015
3e33081
Update results
lauraluiz Nov 15, 2015
4ab4793
Add Handlebars with JSON
lauraluiz Nov 15, 2015
6f003e9
Add Handlebars with JSON results
lauraluiz Nov 15, 2015
fbafa30
Rename Hbs JSON for better understanding
lauraluiz Nov 16, 2015
9678c45
adding rythm to the benchmarks to run
sphogan Nov 29, 2015
f070a64
adding jinjava to the benchmarks
sphogan Nov 29, 2015
c210eb1
Added Rythm template engine.
vkuzel Dec 17, 2015
ca3bcc0
Spaces for tabs.
vkuzel Dec 17, 2015
f0abfbb
Spaces for tabs.
vkuzel Dec 17, 2015
a7bf007
Added HTTL
vkuzel Dec 20, 2015
aec4238
Added link to the HTTL home page.
vkuzel Dec 20, 2015
977c93b
Added chunk templates.
vkuzel Dec 24, 2015
65c2310
Fixed getting templates path for Chunk templates test.
vkuzel Dec 25, 2015
59cf1de
Added Chunk templates link to project description.
vkuzel Dec 25, 2015
82ff44c
Merge branch 'httl'
vkuzel Jan 23, 2016
30b8f3a
Switched Thymeleaf version from 2.x to 3.0 (beta).
vkuzel Jan 23, 2016
32a6972
Results graph has a logarithmic y axe because of Chunk templates result.
vkuzel Jan 24, 2016
f85b632
Removed Chunk templates test because it does not allow to have templa…
vkuzel Jan 26, 2016
cc7e4c7
Added Chunk templates.
vkuzel Feb 1, 2016
87075ce
Added Chunk templates benchmark results.
vkuzel Feb 2, 2016
f5f2f64
Merge remote-tracking branch 'upstream/master'
vkuzel Mar 29, 2016
456e9b7
Newer version of Thymeleaf (BETA03)
vkuzel Apr 25, 2016
5bd3d92
1
May 16, 2016
25729f7
updated thymeleaf to 3.0.0
May 18, 2016
e03f83d
2
May 21, 2016
f58f5b9
New version of Chunk Templates (3.2.1) that fixes template path resol…
vkuzel Jun 6, 2016
d6cd9af
hello
Jun 7, 2016
00c4765
hello
Jun 7, 2016
a87e172
d
xiandafu Jun 7, 2016
bc46d7d
New version of Chunk Templates (3.2.3)
Jul 4, 2016
0dc34e7
Merge pull request #1 from tomj74/master
vkuzel Jul 9, 2016
058c11a
All versions increased
robertotru Jul 9, 2016
7f95156
Updated results. Improved performance of new version of Chunk Templates.
vkuzel Jul 11, 2016
9175c31
Add missing link to Handlebars.java
eneveu Aug 11, 2016
663d83d
add jetg
dyu Oct 20, 2016
d5dcf3b
jetg in readme
dyu Oct 20, 2016
779f5ae
Merge remote-tracking branch 'robertotru/master'
jycr Oct 25, 2016
20d9b5b
Merge remote-tracking branch 'javamonkey/master'
jycr Oct 25, 2016
279f0c8
Merge remote-tracking branch 'eosite/master'
jycr Oct 25, 2016
8228bbd
Merge remote-tracking branch 'lauraluiz/master'
jycr Oct 25, 2016
8f35892
Merge remote-tracking branch 'kawasima/master'
jycr Oct 25, 2016
8368f70
Merge remote-tracking branch 'sphogan/rythm'
jycr Oct 25, 2016
d4dc62d
Merge remote-tracking branch 'sphogan/jinjava'
jycr Oct 25, 2016
851b76b
fix: Remove Moshas because current template and benchmark is incompat…
jycr Oct 25, 2016
d554969
fix: Revert some change from commit a87e172bb4416a3ea947f9f5297cd827e…
jycr Oct 25, 2016
de10113
fix: Fix global merges of all other branches:
jycr Oct 25, 2016
facf719
chore: Update dependencies
jycr Oct 26, 2016
3565c07
Merge remote-tracking branch 'eneveu/patch-1'
jycr Oct 26, 2016
accdc39
Merge remote-tracking branch 'dyu/jetg'
jycr Oct 26, 2016
e75c02c
Merge remote-tracking branch 'keguira/master'
jycr Oct 26, 2016
ae757fa
Merge remote-tracking branch 'spullara/master'
jycr Oct 26, 2016
3eb9806
chore: Update readme and benchmark results
jycr Oct 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ target/
*.war
*.ear
.project
.idea/
.idea_modules/
*.iml
/target/
/BenchmarkList
/CompilerHints
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ template-benchmark

JMH benchmark for popular Java template engines:

* [Beetl](http://ibeetl.com/guide/beetl.html)
* [Chunk Templates](http://www.x5software.com/chunk/examples/ChunkExample)
* [Freemarker](http://freemarker.org/)
* [Handlebars](https://github.com/jknack/handlebars.java)
* [HTTL](http://httl.github.io/en/)
* [Jetg](https://github.com/fbsgen/jetg/)
* [JinJava](https://github.com/HubSpot/jinjava)
* [Mustache](https://github.com/spullara/mustache.java)
* [Pebble](http://www.mitchellbosecke.com/pebble)
* [Rocker](https://github.com/fizzed/rocker)
* [Rythm](http://rythmengine.org/)
* [Thymeleaf](http://www.thymeleaf.org/)
* [Trimou](http://trimou.org/)
* [Velocity](http://velocity.apache.org/)
Expand Down
132 changes: 98 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@
<artifactId>template-benchmark</artifactId>
<version>0.0.1-SNAPSHOT</version>

<prerequisites>
<maven>3.3.3</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.11.2</jmh.version>
<jmh.version>1.15</jmh.version>
<uberjar.name>benchmarks</uberjar.name>

<pebble.version>2.2.0</pebble.version>
<mustache.version>0.9.1</mustache.version>
<pebble.version>2.2.3</pebble.version>
<mustache.version>0.9.4</mustache.version>
<freemarker.version>2.3.23</freemarker.version>
<velocity.version>1.7</velocity.version>
<thymeleaf.version>2.1.4.RELEASE</thymeleaf.version>
<thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
<junit.version>4.12</junit.version>
<trimou.version>1.8.2.Final</trimou.version>
<hbs.version>4.0.1</hbs.version>
<rocker.version>0.10.3</rocker.version>
<trimou.version>2.1.0.Final</trimou.version>
<hbs.version>4.0.6</hbs.version>
<rocker.version>0.13.1</rocker.version>
<rythm.version>1.1.5</rythm.version>
<httl.version>1.0.11</httl.version>
<chunk.version>3.2.3</chunk.version>
<moshas.version>0.2.0</moshas.version>
<jinjava.version>2.1.12</jinjava.version>
<beetl.version>2.5.3</beetl.version>
<jetg.version>1.0.0</jetg.version>
</properties>

<licenses>
Expand All @@ -45,33 +56,33 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<version>${rocker.version}</version>
<executions>
<execution>
<id>generate-rocker-templates</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<templateDirectory>src/main/resources</templateDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<version>${rocker.version}</version>
<executions>
<execution>
<id>generate-rocker-templates</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<templateDirectory>src/main/resources</templateDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.2</version>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -101,6 +112,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/rocker</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand All @@ -118,6 +148,11 @@
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>

<!-- template engines -->
<dependency>
Expand Down Expand Up @@ -155,12 +190,41 @@
<artifactId>handlebars</artifactId>
<version>${hbs.version}</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>rocker-runtime</artifactId>
<version>${rocker.version}</version>
</dependency>

<dependency>
<groupId>com.fizzed</groupId>
<artifactId>rocker-runtime</artifactId>
<version>${rocker.version}</version>
</dependency>
<dependency>
<groupId>com.dyuproject.jetg</groupId>
<artifactId>jetg</artifactId>
<version>${jetg.version}</version>
</dependency>
<dependency>
<groupId>com.hubspot.jinjava</groupId>
<artifactId>jinjava</artifactId>
<version>${jinjava.version}</version>
</dependency>
<dependency>
<groupId>org.rythmengine</groupId>
<artifactId>rythm-engine</artifactId>
<version>${rythm.version}</version>
</dependency>
<dependency>
<groupId>com.github.httl</groupId>
<artifactId>httl-springmvc</artifactId>
<version>${httl.version}</version>
</dependency>
<dependency>
<groupId>com.x5dev</groupId>
<artifactId>chunk-templates</artifactId>
<version>${chunk.version}</version>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>${beetl.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
23 changes: 14 additions & 9 deletions results.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit"
"com.mitchellbosecke.benchmark.Freemarker.benchmark","thrpt",1,50,15370.751504,496.200994,"ops/s"
"com.mitchellbosecke.benchmark.Handlebars.benchmark","thrpt",1,50,17779.570147,552.411776,"ops/s"
"com.mitchellbosecke.benchmark.Mustache.benchmark","thrpt",1,50,22164.070102,598.799830,"ops/s"
"com.mitchellbosecke.benchmark.Pebble.benchmark","thrpt",1,50,32530.043940,849.278116,"ops/s"
"com.mitchellbosecke.benchmark.Rocker.benchmark","thrpt",1,50,39739.408090,1152.244741,"ops/s"
"com.mitchellbosecke.benchmark.Thymeleaf.benchmark","thrpt",1,50,1084.191177,33.698132,"ops/s"
"com.mitchellbosecke.benchmark.Trimou.benchmark","thrpt",1,50,22787.431476,622.350790,"ops/s"
"com.mitchellbosecke.benchmark.Velocity.benchmark","thrpt",1,50,20835.819309,526.312411,"ops/s"
"Benchmark","Mode","Threads","Samples","Score","Score Error (99,9%)","Unit"
"com.mitchellbosecke.benchmark.Beetl.benchmark","thrpt",1,50,"15666,774585","656,914570","ops/s"
"com.mitchellbosecke.benchmark.Chunk.benchmark","thrpt",1,50,"5883,684266","257,748566","ops/s"
"com.mitchellbosecke.benchmark.Freemarker.benchmark","thrpt",1,50,"5451,004903","163,118119","ops/s"
"com.mitchellbosecke.benchmark.Handlebars.benchmark","thrpt",1,50,"6387,580910","296,100660","ops/s"
"com.mitchellbosecke.benchmark.Jetg.benchmark","thrpt",1,50,"14546,490862","473,972646","ops/s"
"com.mitchellbosecke.benchmark.Jinjava.benchmark","thrpt",1,50,"1581,147823","64,137790","ops/s"
"com.mitchellbosecke.benchmark.Mustache.benchmark","thrpt",1,50,"6365,498500","443,382790","ops/s"
"com.mitchellbosecke.benchmark.Pebble.benchmark","thrpt",1,50,"9099,117320","544,265909","ops/s"
"com.mitchellbosecke.benchmark.Rocker.benchmark","thrpt",1,50,"13143,619351","584,978448","ops/s"
"com.mitchellbosecke.benchmark.Rythm.benchmark","thrpt",1,50,"12810,472100","510,246176","ops/s"
"com.mitchellbosecke.benchmark.Thymeleaf.benchmark","thrpt",1,50,"1736,184448","19,138368","ops/s"
"com.mitchellbosecke.benchmark.Trimou.benchmark","thrpt",1,50,"8549,087508","237,374224","ops/s"
"com.mitchellbosecke.benchmark.Velocity.benchmark","thrpt",1,50,"8139,877723","111,253199","ops/s"
Binary file modified results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions src/main/java/com/mitchellbosecke/benchmark/Beetl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.mitchellbosecke.benchmark;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URL;
import java.util.Map;

import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.core.resource.ClasspathResourceLoader;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

public class Beetl extends BaseBenchmark {

private Map<String, Object> context;

GroupTemplate gt = null;

@Setup
public void setup() throws IOException {
ClasspathResourceLoader resourceLoader = new MyClasspathResourceLoader("/");
Configuration cfg = Configuration.defaultConfiguration();
cfg.setStatementStart("@");
cfg.setStatementEnd(null);
cfg.getResourceMap().put("autoCheck", "false");
gt = new GroupTemplate(resourceLoader, cfg);

}

@Benchmark
public String benchmark() throws IOException {
Template template = gt.getTemplate("/templates/stocks.beetl.html");
template.binding(getContext());
Writer writer = new StringWriter();
template.renderTo(writer);

return writer.toString();
}

static class MyClasspathResourceLoader extends ClasspathResourceLoader {

public MyClasspathResourceLoader(String root) {
super(root);
}

@Override
public void init(GroupTemplate gt) {
Map<String, String> resourceMap = gt.getConf().getResourceMap();

if (this.charset == null) {
this.charset = resourceMap.get("charset");

}

this.setAutoCheck(false);

}
}
}
25 changes: 25 additions & 0 deletions src/main/java/com/mitchellbosecke/benchmark/Chunk.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mitchellbosecke.benchmark;

import com.x5.template.Theme;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import java.io.IOException;

public class Chunk extends BaseBenchmark {

private com.x5.template.Chunk chunk;

@Setup
public void setup() throws IOException {
Theme theme = new Theme("templates", "");
theme.setClasspathThemesFolder("/templates");
chunk = theme.makeChunk("stocks.chunk");
}

@Benchmark
public String benchmark() {
chunk.setMultiple(getContext());
return chunk.toString();
}
}
38 changes: 38 additions & 0 deletions src/main/java/com/mitchellbosecke/benchmark/Httl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.mitchellbosecke.benchmark;

import httl.Engine;
import httl.Template;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.text.ParseException;
import java.util.Properties;

public class Httl extends BaseBenchmark {

private Engine engine;

private Template template;

@Setup
public void setup() throws IOException, ParseException {
Properties prop = new Properties();
prop.setProperty("import.packages", "com.mitchellbosecke.benchmark.model,java.util");
prop.setProperty("filter", "null");
prop.setProperty("logger", "null");
engine = Engine.getEngine(prop);

template = engine.getTemplate("templates/stocks.httl.html");
}

@Benchmark
public String benchmark() throws IOException, ParseException {
Writer writer = new StringWriter();
template.render(getContext(), writer);
return writer.toString();
}

}
Loading