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 1e37ec7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"html"
],
"devDependencies": {
"markdown": "*",
"showdown": "*",
"markdown-it": "*",
"front-matter": "^2.3.0",
"glob-to-regexp": "0.3.0",
"gulp": "^3.8.11",
"gulp-concat": "^2.5.2",
"gulp-uglify": "^1.1.0",
"gulp-concat": "^2.5.2"
"markdown": "*",
"markdown-it": "*",
"commonmark": "0.x"
},
"scripts": {
"test": "node test",
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 1e37ec7

Please sign in to comment.