Skip to content

Commit

Permalink
馃И TESTS: Add pyromark to benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Jun 30, 2023
1 parent 14cca38 commit ea0fa62
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
8 changes: 8 additions & 0 deletions benchmarking/bench_packages.py
Expand Up @@ -76,3 +76,11 @@ def test_panflute(benchmark, spec_text):
benchmark(
panflute.convert_text, spec_text, input_format="markdown", output_format="html"
)


@pytest.mark.benchmark(group="packages")
def test_pyromark(benchmark, spec_text):
import pyromark

benchmark.extra_info["version"] = pyromark.__version__
benchmark(pyromark.markdown, spec_text)
26 changes: 14 additions & 12 deletions docs/performance.md
Expand Up @@ -9,20 +9,22 @@ or you can run it for yourself within the repository:
tox -e py311-bench-packages -- --benchmark-columns mean,stddev
```

| package | version | mean (ms) | stddev |
| -------------------- | ------- | --------- | ------- |
| markdown-it-pyrs[^1] | 0.2.1 | 6.410 | 0.426 |
| mistune[^2] | 3.0.1 | 80.409 | 2.335 |
| **markdown-it-py** | 3.0.0 | 97.242 | 4.427 |
| mistletoe | 1.1.0 | 99.633 | 4.628 |
| commonmark-py | 0.9.1 | 300.403 | 9.706 |
| pymarkdown | 3.4.3 | 387.775 | 10.394 |
| pymarkdown (+extras) | 3.4.3 | 646.564 | 11.316 |
| panflute | 2.3.0 | 860.105 | 208.607 |
| package | version | mean (ms) | stddev |
| -------------------- | ------- | --------- | ------ |
| pyromark[^1] | 0.2.0 | 1.123 | 0.029 |
| markdown-it-pyrs[^2] | 0.2.2 | 5.167 | 0.159 |
| **markdown-it-py** | 3.0.0 | 84.969 | 3.028 |
| mistletoe | 1.1.0 | 86.625 | 2.830 |
| mistune[^3] | 3.0.1 | 92.804 | 2.495 |
| commonmark-py | 0.9.1 | 258.978 | 9.344 |
| pymarkdown | 3.4.3 | 334.764 | 0.325 |
| pymarkdown (+extras) | 3.4.3 | 595.462 | 11.333 |
| panflute | 2.3.0 | 1020.401 | 2.806 |

As you can see, `markdown-it-py` doesn't pay with speed for it's flexibility.

[^1]: `markdown-it-pyrs` is a Rust implementation of `markdown-it-py`'s parser, in beta development, check it out at: <https://github.com/chrisjsewell/markdown-it-pyrs>
[^2]: `mistune` is not CommonMark compliant, which is what allows for its
[^1]: `pyromark` is written in Rust. It wins in performance, but is currently inferior in advanced functionality.
[^2]: `markdown-it-pyrs` is a Rust implementation of `markdown-it-py`'s parser, in beta development, check it out at: <https://github.com/chrisjsewell/markdown-it-pyrs>
[^3]: `mistune` is not CommonMark compliant, which is what allows for its
faster parsing, at the expense of issues, for example, with nested inline parsing.
See [mistletoes's explanation](https://github.com/miyuchina/mistletoe/blob/master/performance.md) for further details.
1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -42,6 +42,7 @@ compare = [
"mistune~=3.0",
"panflute~=2.3",
"markdown-it-pyrs",
"pyromark~=0.2.0",
]
linkify = ["linkify-it-py>=1,<3"]
plugins = ["mdit-py-plugins"]
Expand Down

0 comments on commit ea0fa62

Please sign in to comment.