Created
February 23, 2012 14:37
-
-
Save chowey/1893116 to your computer and use it in GitHub Desktop.
Benchmark Multiline Stylus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stylus1 = require('../node_modules/stylus'), | |
stylus2 = require('../cloned/stylus'), | |
Benchmark = require('benchmark'), | |
fs = require('fs'); | |
fs.readFile('C:/node/cloned/stylus/test/cases/regression.127.styl', 'utf8', function (err, str) { | |
if (err) throw err; | |
var handler = function (err, css) { | |
if (err) console.error(err); | |
}; | |
var suite = new Benchmark.Suite; | |
suite.add('Stylus (original)', function () { | |
stylus1(str, {filename: 'regression.127.styl'}, handler); | |
}) | |
.add('Stylus (modified)', function () { | |
stylus2(str, {filename: 'regression.127.styl'}, handler); | |
}) | |
.on('cycle', function (event, bench) { | |
console.log(bench.toString()); | |
}) | |
.on('complete', function () { | |
console.log('Fastest is ' + this.filter('fastest').pluck('name')); | |
}) | |
.run(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c:\node\test>node bench | |
Stylus (original) x 273,162 ops/sec ±0.60% (58 runs sampled) | |
Stylus (modified) x 277,525 ops/sec ±1.19% (60 runs sampled) | |
Fastest is Stylus (original),Stylus (modified) |
The modified code is 1.6% slower for regression.127.styl
and 4.1% slower for control.boilerplate.styl
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, using
control.boilerplate.styl
gives the following results: