marked/test/bench.js

25 lines
525 B
JavaScript
Raw Normal View History

2011-07-24 08:15:35 -05:00
var fs = require('fs')
, text = fs.readFileSync(__dirname + '/in.md', 'utf8');
var benchmark = function(func, t) {
var start = new Date()
, i = t || 10000;
while (i--) func();
console.log('%s: %sms', func.name, new Date() - start);
};
2011-08-10 21:50:25 -05:00
var marked_ = require('../');
benchmark(function marked() {
marked_(text);
2011-07-24 08:15:35 -05:00
});
var showdown_ = require('showdown');
benchmark(function showdown() {
showdown_(text);
});
var markdown_ = require('markdown');
benchmark(function markdownjs() {
markdown_.toHTML(text);
2011-08-10 21:50:25 -05:00
});