From 3026d71e0eea14f71d9f8779d2e12305d6aa67e2 Mon Sep 17 00:00:00 2001 From: Joshua Appelman Date: Fri, 4 Jul 2014 21:21:44 +0200 Subject: [PATCH] Adds benchmarking using matcha. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- benchmark.js | 20 ++++++++++++++++++++ package.json | 1 + 2 files changed, 21 insertions(+) create mode 100644 benchmark.js diff --git a/benchmark.js b/benchmark.js new file mode 100644 index 0000000..dcee1e7 --- /dev/null +++ b/benchmark.js @@ -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') + '!') ; + }); + +}); diff --git a/package.json b/package.json index 7fc8ba7..26db021 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "supports-color": "^0.2.0" }, "devDependencies": { + "matcha": "^0.5.0", "mocha": "*" } }