Permalink
Browse files

Added cached benchmarks

  • Loading branch information...
1 parent bbbd838 commit 772da5a4d32dd147c27205e44bfbbdef788a7bed @tj tj committed Jun 27, 2010
Showing with 13 additions and 5 deletions.
  1. +1 −1 benchmark/layout.haml
  2. +1 −1 benchmark/layout.jade
  3. +11 −3 benchmark/run.js
View
@@ -3,7 +3,7 @@
%head
%title Jade
%body
- %h1#title Jade rules
+ %h1#title= title
%ul
%li.first a
View
@@ -3,7 +3,7 @@ html
head
title Jade
body
- h1#title Jade rules
+ h1#title= title
ul
li.first a
View
@@ -39,14 +39,22 @@ function bm(label, fn) {
var jadeStr = fs.readFileSync(__dirname + '/layout.jade', 'utf8');
var hamlStr = fs.readFileSync(__dirname + '/layout.haml', 'utf8');
-// Jade
+// Benchmarks
bm('jade render', function(){
- jade.render(jadeStr);
+ jade.render(jadeStr, { locals: { title: 'Jade' }});
});
bm('haml.js render', function(){
- haml.render(hamlStr);
+ haml.render(hamlStr, { locals: { title: 'Haml' }});
+});
+
+bm('jade cached', function(){
+ jade.render(jadeStr, { cache: true, filename: 'layout.jade', locals: { title: 'Jade' }});
+});
+
+bm('haml.js cached', function(){
+ haml.render(hamlStr, { cache: true, filename: 'layout.haml', locals: { title: 'Haml' }});
});

0 comments on commit 772da5a

Please sign in to comment.