blob: 2e35310cd7d6837f2bfab68be82d67358e6c0160 [file] [log] [blame]
const Benchmark = require('benchmark');
const mime = require('..');
const mimeLite = require('../lite');
const suite = new Benchmark.Suite();
const extensions = Object.keys(mime._types);
let idx = 0;
suite
.add('mime.getType',
function() {
mime.getType(extensions[idx++]);
if (idx >= extensions.length) idx = 0;
}
)
.add('mimeLite.getType',
function() {
mimeLite.getType(extensions[idx++]);
if (idx >= extensions.length) idx = 0;
}
)
.on('cycle', function(event) {
console.log(String(event.target));
})
.run();