Skip to content

Commit

Permalink
Add colorette to the benchmarks
Browse files Browse the repository at this point in the history
Upgrade chalk to the latest version too.
  • Loading branch information
prantlf committed Dec 30, 2020
1 parent fc9cc25 commit a2cd1e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions bench/colors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const chalk = require('chalk');
const ansi = require('ansi-colors');
const colorette = require('colorette');
const { Suite } = require('benchmark');
const colors = require('../colors');
const kleur = require('../index');
Expand All @@ -24,6 +25,9 @@ bench('All Colors')
.add('chalk', () => {
names.forEach(name => chalk[name]('foo'));
})
.add('colorette', () => {
names.forEach(name => colorette[name]('foo'));
})
.add('kleur', () => {
names.forEach(name => kleur[name]('foo'));
})
Expand All @@ -40,6 +44,9 @@ bench('Stacked colors')
.add('chalk', () => {
names.forEach(name => chalk[name].bold.underline.italic('foo'));
})
.add('colorette', () => {
names.forEach(name => colorette[name](colorette.bold(colorette.underline(colorette.italic('foo')))));
})
.add('kleur', () => {
names.forEach(name => kleur[name]().bold().underline().italic('foo'));
})
Expand All @@ -52,6 +59,7 @@ bench('Stacked colors')
bench('Nested colors')
.add('ansi-colors', () => fixture(ansi))
.add('chalk', () => fixture(chalk))
.add('colorette', () => fixture(colorette))
.add('kleur', () => fixture(kleur))
.add('kleur/colors', () => fixture(colors))
.run();
Expand Down
4 changes: 4 additions & 0 deletions bench/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ console.timeEnd('kleur/colors');
console.time('ansi-colors');
const color = require('ansi-colors');
console.timeEnd('ansi-colors');

console.time('colorette');
const colorette = require('colorette');
console.timeEnd('colorette');
3 changes: 2 additions & 1 deletion bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"devDependencies": {
"ansi-colors": "4.1.1",
"benchmark": "2.1.4",
"chalk": "4.0.0"
"chalk": "4.1.0",
"colorette": "1.2.1"
}
}

0 comments on commit a2cd1e5

Please sign in to comment.