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.git
2. Install dependencies:
npm install
3. Launch the benchmark by executing:
node main.js
4. 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)
pug
=> 504ms
igodust
=> 603ms
eta
=> 610ms
handlebars
=> 1181ms
ejs
=> 3618ms
liquidjs
=> 14825ms
pug
=> 6ms
igodust
=> 7ms
liquidjs
=> 82ms
eta
=> 88ms
ejs
=> 130ms
handlebars
=> 38ms
igodust
=> 42ms
eta
=> 109ms
liquidjs
=> 145ms
pug
=> 157ms
ejs
=> 185ms
igodust
=> 8ms
handlebars
=> 36ms
eta
=> 106ms
liquidjs
=> 141ms
pug
=> 156ms
ejs
=> 179ms
igodust
=> 16ms
pug
=> 57ms
handlebars
=> 146ms
eta
=> 164ms
ejs
=> 585ms
liquidjs
=> 1328ms
pug
=> 1ms
igodust
=> 5ms
liquidjs
=> 7ms
handlebars
=> 11ms
ejs
=> 59ms
eta
=> 64ms
pug
=> 7ms
igodust
=> 10ms
handlebars
=> 19ms
eta
=> 88ms
liquidjs
=> 94ms
ejs
=> 166ms
pug
=> 6ms
igodust
=> 9ms
handlebars
=> 14ms
eta
=> 89ms
liquidjs
=> 91ms
ejs
=> 149ms
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 😃❤️