This repository has been archived by the owner on Feb 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bench: use
benchmark
instead of matcha
- Loading branch information
blond
committed
Apr 15, 2016
1 parent
21d02fb
commit 760e094
Showing
23 changed files
with
74 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.nyc_output | ||
node_modules | ||
coverage | ||
benchmark/fixtures/libs/** | ||
benchmark/node_modules/** | ||
bench/fixtures/libs/** | ||
bench/node_modules/** |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.nyc_output | ||
node_modules | ||
coverage | ||
benchmark/fixtures/libs | ||
bench/fixtures/libs |
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const vow = require('vow'); | ||
const Level = require('enb/lib/levels/level'); | ||
const LevelPlain = require('enb/lib/levels/level-plain'); | ||
|
||
module.exports = function run(levels, scheme, done) { | ||
var plain = scheme === 'flat' ? LevelPlain : null; | ||
|
||
vow.all(levels.map(function (level) { | ||
return (new Level(level, plain)).load(); | ||
})).then(done, done); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
const Benchmark = require('Benchmark'); | ||
const async = require('async'); | ||
|
||
const fixtures = require('./fixtures'); | ||
|
||
const walk = require('../lib'); | ||
const enb = require('./enb'); | ||
const scanl = require('./scan-level'); | ||
|
||
const cases = [ | ||
{ name: 'flat level', levels: fixtures.levels.flat, scheme: 'flat' }, | ||
{ name: 'nested level', levels: fixtures.levels.nested, scheme: 'nested' }, | ||
{ name: 'bem-bl', levels: fixtures.libs['bem-bl'], scheme: 'nested' }, | ||
{ name: 'bem-components', levels: fixtures.libs.o2, scheme: 'nested' } | ||
]; | ||
|
||
async.eachSeries(cases, function iteratee(item, callback) { | ||
const suite = new Benchmark.Suite(item.name); | ||
|
||
suite | ||
.add('bem-walk', deferred => { | ||
walk(item.levels, { defaults: { scheme: item.scheme } }) | ||
.resume().on('end', () => deferred.resolve()); | ||
}, { defer: true }) | ||
.add(' enb', deferred => { | ||
enb(item.levels, item.scheme, () => deferred.resolve()); | ||
}, { defer: true }) | ||
.add(' scanl', deferred => { | ||
scanl(item.levels, item.scheme, () => deferred.resolve()); | ||
}, { defer: true }) | ||
.on('start', () => { | ||
console.log(' ' + item.name) | ||
}) | ||
.on('cycle', event => { | ||
const target = event.target; | ||
const mean = target.stats.mean * 1000; | ||
|
||
console.log(`${target} mean ${mean.toFixed(2)} ms`); | ||
}) | ||
.on('complete', () => { | ||
console.log(''); | ||
callback(); | ||
}) | ||
.run(); | ||
}); |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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