diff --git a/.gitmodules b/.gitmodules index 80f0822c5..4871068b7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "benchmarks/ejs"] path = benchmarks/ejs url = git://github.com/visionmedia/ejs.git +[submodule "benchmarks/haml"] + path = benchmarks/haml + url = git://github.com/visionmedia/haml.js.git diff --git a/Makefile b/Makefile index e0ef2d5c0..a8831158d 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ api.html: lib/jade.js benchmark: @node benchmarks/jade.js && \ node benchmarks/haml.js && \ + node benchmarks/haml2.js && \ node benchmarks/ejs.js .PHONY: install uninstall test example benchmark \ No newline at end of file diff --git a/benchmarks/example2.haml b/benchmarks/example2.haml new file mode 100644 index 000000000..236e790c3 --- /dev/null +++ b/benchmarks/example2.haml @@ -0,0 +1,6 @@ +%ul + %li!= one + %li!= two + %li!= three + - each item in items + %li!= item \ No newline at end of file diff --git a/benchmarks/haml b/benchmarks/haml new file mode 160000 index 000000000..382bc11ce --- /dev/null +++ b/benchmarks/haml @@ -0,0 +1 @@ +Subproject commit 382bc11ce4fd03403bcf2c0ed5545a4c891b60c2 diff --git a/benchmarks/haml.js b/benchmarks/haml.js index c45442ce1..7afbf36bf 100644 --- a/benchmarks/haml.js +++ b/benchmarks/haml.js @@ -10,7 +10,7 @@ var bm = require('./common'), var str = fs.readFileSync(__dirname + '/example.haml', 'ascii'); var n = bm.times; -bm.start('haml compilation'); +bm.start('haml-js compilation'); while (n--) { haml(str); } @@ -18,7 +18,7 @@ bm.stop(); var n = bm.times; var fn = haml(str); -bm.start('haml execution'); +bm.start('haml-js execution'); while (n--) { fn.call('whatever scope', bm.locals); } diff --git a/benchmarks/haml2.js b/benchmarks/haml2.js new file mode 100644 index 000000000..b1ad2992b --- /dev/null +++ b/benchmarks/haml2.js @@ -0,0 +1,30 @@ + +/** + * Module dependencies. + */ + +var bm = require('./common'), + haml = require('./haml/lib/haml'), + fs = require('fs'); + +var str = fs.readFileSync(__dirname + '/example2.haml', 'ascii'); + +var n = bm.times; +bm.start('haml compilation'); +while (n--) { + haml.render(str, { + locals: bm.locals + }); +} +bm.stop(); + +var n = bm.times; +bm.start('haml execution'); +while (n--) { + haml.render(str, { + locals: bm.locals, + cache: true, + filename: 'example2.haml' + }); +} +bm.stop(); \ No newline at end of file