Simple app for client side templating engines benchmarks
Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
app
config
db
doc
lib
log
public
script
test
vendor
.gitignore
Gemfile
Gemfile.lock
README
Rakefile
config.ru

README

== Underscore

var N = 50000;
var start_time = new Date().getTime();
var comment = {
      votes_count: 123,
      voted: true,
      content: 'test comment',
      uname: 'test',
      ulink: '/test',
      uimage: '',
      isHost: true,
      accepted: true,
      score: {}
    };
for (i=0;i<=N;i=i+1)
{
  templates_underscore(comment);
}

var finish_time = new Date().getTime();
console.log("underscore " + N);
console.log(N/(finish_time - start_time)*1000);

== doT

var N = 50000;
var start_time = new Date().getTime();
var comment = {
      votes_count: 123,
      voted: true,
      content: 'test comment',
      uname: 'test',
      ulink: '/test',
      uimage: '',
      isHost: true,
      accepted: true,
      score: {}
    };
for (i=0;i<=N;i=i+1)
{
  templates_doT(comment);
}

var finish_time = new Date().getTime();
console.log("doT " + N);
console.log(N/(finish_time - start_time)*1000);

== doT

var N = 50000;
var start_time = new Date().getTime();
var comment = {
      votes_count: 123,
      voted: true,
      content: 'test comment',
      uname: 'test',
      ulink: '/test',
      uimage: '',
      isHost: true,
      accepted: true,
      score: {}
    };
for (i=0;i<=N;i=i+1)
{
  templates_doT(comment);
}

var finish_time = new Date().getTime();
console.log("doT " + N);
console.log(N/(finish_time - start_time)*1000);

=== EJS

var N = 50000;
var start_time = new Date().getTime();
var comment = {
      votes_count: 123,
      voted: true,
      content: 'test comment',
      uname: 'test',
      ulink: '/test',
      uimage: '',
      isHost: true,
      accepted: true,
      score: {}
    };
for (i=0;i<=N;i=i+1)
{
  JST.ejs_template(comment);
}

var finish_time = new Date().getTime();
console.log("EJS " + N);
console.log(N/(finish_time - start_time)*1000);

=== SOY

var N = 50000;
var start_time = new Date().getTime();
var comment = {
      votes_count: 123,
      voted: true,
      content: 'test comment',
      uname: 'test',
      ulink: '/test',
      uimage: '',
      isHost: true,
      accepted: true,
      score: {}
    };
for (i=0;i<=N;i=i+1)
{
  app.templates.soy(comment);
}

var finish_time = new Date().getTime();
console.log("soy " + N);
console.log(N/(finish_time - start_time)*1000);


=== Results

Chromium 15.0

soy 50000
149253.73134328358
118764.84560570071

EJS 50000
144508.67052023122
142857.14285714287

doT 50000
526315.7894736842
561797.7528089888

underscore 50000
155279.50310559006
144092.2190201729


FireFox 3.6

underscore 50000
43290.04329004329
53134.96280552604

doT 50000
87565.67425569177
62344.13965087282

EJS 50000
51652.89256198347
54945.054945054944

soy 50000
36549.707602339186
36023.054755043224