Skip to content
This repository was archived by the owner on Mar 15, 2023. It is now read-only.
/ marked Public archive
forked from markedjs/marked

Commit 6a30b51

Browse files
author
Hsiaoming Yang
committed
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
1 parent 6959c20 commit 6a30b51

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ clean:
66
@rm marked.js
77
@rm marked.min.js
88

9+
bench:
10+
@node test --bench
11+
912
.PHONY: clean all

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ For those feeling skeptical: These benchmarks run the entire markdown test suite
3434
1000 times. The test suite tests every feature. It doesn't cater to specific
3535
aspects.
3636

37+
node v0.8.x
38+
39+
``` bash
40+
$ node test --bench
41+
marked completed in 3411ms.
42+
marked (gfm) completed in 3727ms.
43+
marked (pedantic) completed in 3201ms.
44+
robotskirt completed in 808ms.
45+
showdown (reuse converter) completed in 11954ms.
46+
showdown (new converter) completed in 17774ms.
47+
markdown-js completed in 17191ms.
48+
```
49+
3750
## Install
3851

3952
``` bash

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@
1212
"bugs": { "url": "http://github.com/chjj/marked/issues" },
1313
"keywords": ["markdown", "markup", "html"],
1414
"tags": ["markdown", "markup", "html"],
15+
"devDependencies": {
16+
"markdown": "*",
17+
"showdown": "*",
18+
"robotskirt": "*"
19+
},
1520
"scripts": { "test": "node test", "bench": "node test --bench" }
1621
}

test/index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,16 @@ function runBench(options) {
237237
}
238238
bench('marked (pedantic)', marked);
239239

240-
// Discount
241-
var discount = require('discount').parse;
242-
bench('discount', discount);
240+
// robotskirt
241+
var rs = require('robotskirt');
242+
bench('robotskirt', function(text) {
243+
var parser = rs.Markdown.std();
244+
return parser.render(text);
245+
});
243246

244247
// Showdown (Reusing the converter)
245248
var showdown = (function() {
246-
var Showdown = require('showdown').Showdown;
249+
var Showdown = require('showdown');
247250
var convert = new Showdown.converter();
248251
return function(text) {
249252
return convert.makeHtml(text);
@@ -253,7 +256,7 @@ function runBench(options) {
253256

254257
// Showdown
255258
var showdown_slow = (function() {
256-
var Showdown = require('showdown').Showdown;
259+
var Showdown = require('showdown');
257260
return function(text) {
258261
var convert = new Showdown.converter();
259262
return convert.makeHtml(text);
@@ -263,9 +266,7 @@ function runBench(options) {
263266

264267
// markdown-js
265268
var markdownjs = require('markdown');
266-
bench('markdown-js', function(text) {
267-
markdownjs.parse(text);
268-
});
269+
bench('markdown-js', markdownjs.parse);
269270
}
270271

271272
/**

0 commit comments

Comments
 (0)