Skip to content

Commit

Permalink
bench against commonmark instead of showdown, which is super slow
Browse files Browse the repository at this point in the history
  • Loading branch information
Feder1co5oave committed Feb 1, 2018
1 parent 6b0416d commit bdffc69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"devDependencies": {
"markdown": "*",
"showdown": "*",
"commonmark": "0.x",
"markdown-it": "*",
"front-matter": "^2.3.0",
"glob-to-regexp": "0.3.0",
Expand Down
18 changes: 6 additions & 12 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,16 @@ function runBench(options) {

// showdown
try {
bench('showdown (reuse converter)', files, (function() {
var Showdown = require('showdown');
var convert = new Showdown.Converter();
bench('commonmark', files, (function() {
var commonmark = require('commonmark')
, parser = new commonmark.Parser()
, writer = new commonmark.HtmlRenderer();
return function(text) {
return convert.makeHtml(text);
};
})());
bench('showdown (new converter)', files, (function() {
var Showdown = require('showdown');
return function(text) {
var convert = new Showdown.Converter();
return convert.makeHtml(text);
return writer.render(parser.parse(text));
};
})());
} catch (e) {
console.log('Could not bench showdown. (Error: %s)', e.message);
console.log('Could not bench commonmark. (Error: %s)', e.message);
}

// markdown-it
Expand Down

0 comments on commit bdffc69

Please sign in to comment.