Skip to content

Commit

Permalink
Adds benchmarking using matcha.
Browse files Browse the repository at this point in the history
Run through:
```shell
./node_modules/matcha/bin/matcha benchmark.js
```

Results against current HEAD:
```shell
1,863,195 op/s » add colour
2,215,812 op/s » add several styles
  323,213 op/s » add nested styles
```

Results against the latest revision before optiziations, e122899
```shell
  26,714 op/s » add colour
  26,752 op/s » add several styles
  13,414 op/s » add nested styles
```

Closes #21
  • Loading branch information
Joshua Appelman committed Jul 4, 2014
1 parent e122899 commit 3026d71
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ran through matcha
// ./node_modules/matcha/bin/matcha benchmark.js

var chalk = require('./index.js');

suite('chalk', function(){

bench('add colour', function(){
chalk.red('the fox jumps over the lazy dog');
});

bench('add several styles', function(){
chalk.blue.bgRed.bold('the fox jumps over the lazy dog') ;
});

bench('add nested styles', function(){
chalk.red('the fox jumps ', chalk.underline.bgBlue('over the lazy dog') + '!') ;
});

});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"supports-color": "^0.2.0"
},
"devDependencies": {
"matcha": "^0.5.0",
"mocha": "*"
}
}

0 comments on commit 3026d71

Please sign in to comment.