Skip to content

Commit

Permalink
Update performance benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Aug 17, 2023
1 parent 80bd7a6 commit f24b38b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ python -m pip install -U pyromark

## Performance

118x faster than [Markdown](https://pypi.org/project/Markdown/),
99x faster than [markdown-it-py](https://pypi.org/project/markdown-it-py/),
73x faster than [mistune](https://pypi.org/project/mistune/),
7x faster than [markdown-it-pyrs](https://pypi.org/project/markdown-it-pyrs/).
128x faster than [Markdown](https://pypi.org/project/Markdown/),
105x faster than [markdown-it-py](https://pypi.org/project/markdown-it-py/),
79x faster than [mistune](https://pypi.org/project/mistune/),
8x faster than [markdown-it-pyrs](https://pypi.org/project/markdown-it-pyrs/).

If you use threading, the difference with other libraries will be even more enormous, since pyromark releases the [GIL](https://docs.python.org/3/glossary.html#term-global-interpreter-lock).

Expand Down
22 changes: 11 additions & 11 deletions docs/performance.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Performance

118x faster than [Markdown](https://pypi.org/project/Markdown/),
99x faster than [markdown-it-py](https://pypi.org/project/markdown-it-py/),
73x faster than [mistune](https://pypi.org/project/mistune/),
7x faster than [markdown-it-pyrs](https://pypi.org/project/markdown-it-pyrs/).
128x faster than [Markdown](https://pypi.org/project/Markdown/),
105x faster than [markdown-it-py](https://pypi.org/project/markdown-it-py/),
79x faster than [mistune](https://pypi.org/project/mistune/),
8x faster than [markdown-it-pyrs](https://pypi.org/project/markdown-it-pyrs/).

If you use threading, the difference with other libraries will be even more enormous, since pyromark releases the [GIL](https://docs.python.org/3/glossary.html#term-global-interpreter-lock).

Expand All @@ -20,24 +20,24 @@ In [2]: (
...: mistune.__version__,
...: markdown_it_pyrs.__version__,
...: )
Out[2]: ('3.4.3', '3.0.0', '3.0.1', '0.2.2')
Out[2]: ('3.4.4', '3.0.0', '3.0.1', '0.3.0')

In [3]: text = requests.get(
...: "https://raw.githubusercontent.com/rust-lang/rust/1.70.0/README.md"
...: "https://raw.githubusercontent.com/rust-lang/rust/1.71.1/README.md"
...: ).text

In [4]: %timeit markdown.markdown(text)
7.53 ms ± 21.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
7.66 ms ± 31.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [5]: %timeit markdown_it.MarkdownIt().render(text)
6.33 ms ± 50.2 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
6.25 ms ± 28.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [6]: %timeit mistune.html(text)
4.68 ms ± 7.26 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
4.73 ms ± 10.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [7]: %timeit markdown_it_pyrs.MarkdownIt().render(text)
458 µs ± 596 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
460 µs ± 1.33 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

In [8]: %timeit pyromark.markdown(text)
63.7 µs ± 202 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
59.7 µs ± 171 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
```

0 comments on commit f24b38b

Please sign in to comment.