From c360bb0e1767cd89e51a8580c29c2ccfbbd5a0f1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 17 Jan 2015 21:01:39 -0800 Subject: Added new fine-grained JS benchmarks. And a script to run them. --- benchmarks.md | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'benchmarks.md') diff --git a/benchmarks.md b/benchmarks.md index fc06126..b5ea64a 100644 --- a/benchmarks.md +++ b/benchmarks.md @@ -34,14 +34,45 @@ interrupt runs. ## JavaScript libraries -Here are some JavaScript benchmarks using `node.js`. -They can be run using `make benchjs`. The source text is -the CommonMark `README.md` file, but can be configured by -setting the `BENCHINP` environment variable. - -Implementation | Ops/sec -----------------|--------- -commonmark.js | 586 -showdown.js | 171 -marked.js | 564 -markdown-it | 760 +Here are some focused benchmarks of four JavaScript libraries. +(using version available on 17 Jan 2015). They test performance +on different kinds of Markdown texts. With the exception of +the first (the `README.md` from this project), the samples are taken +from the [markdown-it](https://github.com/markdown-it/markdown-it) +repository. Results show a ratio of ops/second (higher is better) +against the slowest implementation (always showdown). + +| Sample |showdown |commonmark|marked |markdown-it| +|------------------------|---------:|---------:|---------:|----------:| +|README.md | 1| 3.2| 3.1| 4.4| +|block-bq-flat.md | 1| 8.0| 12.8| 11.3| +|block-bq-nested.md | 1| 10.8| 9.9| 12.6| +|block-code.md | 1| 24.9| 58.4| 83.2| +|block-fences.md | 1| 16.4| 66.5| 65.5| +|block-heading.md | 1| 10.7| 11.0| 17.5| +|block-hr.md | 1| 14.4| 14.6| 37.7| +|block-html.md | 1| 7.9| 2.8| 14.8| +|block-lheading.md | 1| 14.4| 17.7| 26.1| +|block-list-flat.md | 1| 4.3| 4.3| 10.4| +|block-list-nested.md | 1| 7.4| 5.7| 19.1| +|block-ref-flat.md | 1| 1.8| 1.1| 1.5| +|block-ref-nested.md | 1| 1.5| 1.4| 2.4| +|inline-autolink.md | 1| 4.1| 7.0| 4.5| +|inline-backticks.md | 1| 15.8| 13.7| 30.7| +|inline-em-flat.md | 1| 4.1| 3.8| 8.7| +|inline-em-nested.md | 1| 5.2| 4.6| 8.3| +|inline-em-worst.md | 1| 5.3| 4.9| 3.4| +|inline-entity.md | 1| 4.8| 9.7| 7.7| +|inline-escape.md | 1| 4.6| 2.9| 12.4| +|inline-html.md | 1| 3.6| 5.2| 5.0| +|inline-links-flat.md | 1| 3.7| 4.0| 4.1| +|inline-links-nested.md | 1| 3.8| 1.0| 1.5| +|inline-newlines.md | 1| 6.9| 6.5| 13.1| +|rawtabs.md | 1| 8.9| 9.7| 13.4| + +To run these: + +1. `npm install marked showdown markdown-it` +2. Create a `samples` subdirectory and copy the samples you + want to test into it. +3. `sh tools/detailed_benchmarks.sh` -- cgit v1.2.3