1. fix benchmark for showdown
2. remove discount benchmark // not working on v0.8.x 3. add robotskirt benchmark 4. add target of bench in Makefile 5. add devDependencies in package.json
This commit is contained in:
parent
6959c202da
commit
6a30b517b1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
3
Makefile
3
Makefile
@ -6,4 +6,7 @@ clean:
|
|||||||
@rm marked.js
|
@rm marked.js
|
||||||
@rm marked.min.js
|
@rm marked.min.js
|
||||||
|
|
||||||
|
bench:
|
||||||
|
@node test --bench
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
|
13
README.md
13
README.md
@ -34,6 +34,19 @@ For those feeling skeptical: These benchmarks run the entire markdown test suite
|
|||||||
1000 times. The test suite tests every feature. It doesn't cater to specific
|
1000 times. The test suite tests every feature. It doesn't cater to specific
|
||||||
aspects.
|
aspects.
|
||||||
|
|
||||||
|
node v0.8.x
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
$ node test --bench
|
||||||
|
marked completed in 3411ms.
|
||||||
|
marked (gfm) completed in 3727ms.
|
||||||
|
marked (pedantic) completed in 3201ms.
|
||||||
|
robotskirt completed in 808ms.
|
||||||
|
showdown (reuse converter) completed in 11954ms.
|
||||||
|
showdown (new converter) completed in 17774ms.
|
||||||
|
markdown-js completed in 17191ms.
|
||||||
|
```
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
|
@ -12,5 +12,10 @@
|
|||||||
"bugs": { "url": "http://github.com/chjj/marked/issues" },
|
"bugs": { "url": "http://github.com/chjj/marked/issues" },
|
||||||
"keywords": ["markdown", "markup", "html"],
|
"keywords": ["markdown", "markup", "html"],
|
||||||
"tags": ["markdown", "markup", "html"],
|
"tags": ["markdown", "markup", "html"],
|
||||||
|
"devDependencies": {
|
||||||
|
"markdown": "*",
|
||||||
|
"showdown": "*",
|
||||||
|
"robotskirt": "*"
|
||||||
|
},
|
||||||
"scripts": { "test": "node test", "bench": "node test --bench" }
|
"scripts": { "test": "node test", "bench": "node test --bench" }
|
||||||
}
|
}
|
||||||
|
@ -237,13 +237,16 @@ function runBench(options) {
|
|||||||
}
|
}
|
||||||
bench('marked (pedantic)', marked);
|
bench('marked (pedantic)', marked);
|
||||||
|
|
||||||
// Discount
|
// robotskirt
|
||||||
var discount = require('discount').parse;
|
var rs = require('robotskirt');
|
||||||
bench('discount', discount);
|
bench('robotskirt', function(text) {
|
||||||
|
var parser = rs.Markdown.std();
|
||||||
|
return parser.render(text);
|
||||||
|
});
|
||||||
|
|
||||||
// Showdown (Reusing the converter)
|
// Showdown (Reusing the converter)
|
||||||
var showdown = (function() {
|
var showdown = (function() {
|
||||||
var Showdown = require('showdown').Showdown;
|
var Showdown = require('showdown');
|
||||||
var convert = new Showdown.converter();
|
var convert = new Showdown.converter();
|
||||||
return function(text) {
|
return function(text) {
|
||||||
return convert.makeHtml(text);
|
return convert.makeHtml(text);
|
||||||
@ -253,7 +256,7 @@ function runBench(options) {
|
|||||||
|
|
||||||
// Showdown
|
// Showdown
|
||||||
var showdown_slow = (function() {
|
var showdown_slow = (function() {
|
||||||
var Showdown = require('showdown').Showdown;
|
var Showdown = require('showdown');
|
||||||
return function(text) {
|
return function(text) {
|
||||||
var convert = new Showdown.converter();
|
var convert = new Showdown.converter();
|
||||||
return convert.makeHtml(text);
|
return convert.makeHtml(text);
|
||||||
@ -263,9 +266,7 @@ function runBench(options) {
|
|||||||
|
|
||||||
// markdown-js
|
// markdown-js
|
||||||
var markdownjs = require('markdown');
|
var markdownjs = require('markdown');
|
||||||
bench('markdown-js', function(text) {
|
bench('markdown-js', markdownjs.parse);
|
||||||
markdownjs.parse(text);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user