chalk/benchmark.js
Sean McArthur 42918337e5 return a new function for each getter
- defines the getters onto a proto
- the function returned has its __proto__ set to our proto

fixes #32
2014-07-09 10:54:59 -07:00

22 lines
536 B
JavaScript

var chalk = require('./');
suite('chalk', function () {
set('iterations', 100000);
bench('single style', function () {
chalk.red('the fox jumps over the lazy dog');
});
bench('several styles', function () {
chalk.blue.bgRed.bold('the fox jumps over the lazy dog');
});
var cached = chalk.blue.bgRed.bold;
bench('cached styles', function () {
cached('the fox jumps over the lazy dog');
});
bench('nested styles', function () {
chalk.red('the fox jumps', chalk.underline.bgBlue('over the lazy dog') + '!');
});
});