Code Monkey home page Code Monkey logo

templating-engine-bench's Introduction

Templating Engine Benchmark

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.

How to use ?

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.

Current results

The tests were carried out on:

  • Node v20.12.0
  • MacBook Pro M1, 13-inch with 16GB of RAM (2020)

RENDER

friends (runned 5000 times)

pug => 120ms
eta => 601ms
igodust => 823ms
ejs => 869ms
handlebars => 904ms
liquidjs => 17145ms

if-expression (runned 5000 times)

pug => 6ms
eta => 102ms
ejs => 154ms
igodust => 156ms
liquidjs => 483ms

projects-escaped (runned 5000 times)

handlebars => 42ms
eta => 126ms
igodust => 153ms
pug => 161ms
ejs => 212ms
liquidjs => 455ms

projects-unescaped (runned 5000 times)

handlebars => 39ms
igodust => 119ms
eta => 125ms
pug => 154ms
ejs => 213ms
liquidjs => 455ms

search-results (runned 5000 times)

pug => 41ms
handlebars => 157ms
igodust => 175ms
eta => 186ms
ejs => 660ms
liquidjs => 1996ms

simple-0 (runned 5000 times)

pug => 2ms
handlebars => 9ms
igodust => 56ms
eta => 70ms
ejs => 72ms
liquidjs => 105ms

simple-1 (runned 5000 times)

pug => 8ms
handlebars => 19ms
eta => 104ms
igodust => 127ms
ejs => 197ms
liquidjs => 452ms

simple-2 (runned 5000 times)

pug => 7ms
handlebars => 16ms
eta => 104ms
igodust => 107ms
ejs => 179ms
liquidjs => 380ms

Adding a new Template Engine

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
 └── ...

⚠️ WARNING: Asynchronous rendering methods, such as those returning Promises, are not supported by the benchmarking tool at the moment. Ensure that your rendering method is synchronous to work with the benchmarking tool effectively. ⚠️

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!

templating-engine-bench's People

Contributors

itsarnaud avatar

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.