This project is a benchmark designed to evaluate the performance of various JavaScript template engines. It allows developers to compare rendering performance of several popular template engines in various scenarios.
1. Clone this repo on your machine:
git clone https://github.com/itsarnaud/templating-engine-bench.git2. Install dependencies:
npm install3. Launch the benchmark by executing:
node main.js4. Results:
Once the benchmark is completed, the results will be automatically updated in the readme file.
The tests were carried out on:
- Node v21.7.2
- MacBook Air M2, 15-inch with 16GB of RAM (2023)
igodust => 27ms
pug => 110ms
ejs => 576ms
handlebars => 711ms
eta => 722ms
dustjs => 1051ms
liquidjs => 14361ms
pug => 12ms
dustjs => 13ms
igodust => 23ms
ejs => 78ms
liquidjs => 115ms
eta => 339ms
igodust => 27ms
handlebars => 41ms
dustjs => 43ms
pug => 86ms
ejs => 140ms
liquidjs => 162ms
eta => 378ms
dustjs => 16ms
igodust => 25ms
handlebars => 35ms
pug => 81ms
ejs => 126ms
liquidjs => 151ms
eta => 359ms
igodust => 27ms
pug => 41ms
dustjs => 101ms
handlebars => 131ms
eta => 377ms
ejs => 413ms
liquidjs => 1331ms
dustjs => 1ms
pug => 2ms
handlebars => 8ms
liquidjs => 18ms
ejs => 23ms
igodust => 25ms
eta => 276ms
pug => 9ms
dustjs => 13ms
handlebars => 22ms
igodust => 24ms
ejs => 98ms
liquidjs => 119ms
eta => 339ms
dustjs => 9ms
pug => 9ms
handlebars => 15ms
igodust => 26ms
ejs => 93ms
liquidjs => 114ms
eta => 332ms
To add a new template engine to this project, follow these simple steps:
1. Create a file for the template engine:
In the engines directory, create a new file named after your template engine, for example my-engine.js. Take a look at the files already created for the syntax.
engines
├── igodust.js
├── my-engine.js
└── ...
2. Add test templates:
Place your template files in the templates directory, following the existing structure. Each test group should have a data file (.js or .json) and template files for each template engine you want to include in the benchmark.
templates
├── group1
│ ├── data.js (or json)
│ ├── template.dust
│ ├── template.my-engine
│ └── ...
└── ...
And that's it, all you have to do is launch the benchmark!
PRs are welcome 😃❤️