[Python-Dev] PEP 576/579/580 benchmark: mistune

Jeroen Demeyer J.Demeyer at UGent.be
Fri Jul 27 09:35:14 EDT 2018

Hello all,

since my latest benchmark for PEP 580 [1] involved SageMath, which is 
quite a big project, I instead propose a much simpler benchmark 
involving mistune.

mistune [2] is a Markdown parser implemented in the Python language. It 
optionally allows Cython compilation. It doesn't use any kind of 
optimization beyond that, but I created a branch [3] to use extension 
types instead of Python classes.

Cython can either use built-in functions/methods or a custom class 
(which is not optimized but which would be optimized with PEP 580).

I benchmarked mistune with custom classes [3] (binding=True, the 
default) and with built-in functions/methods [4] (binding=False). This 
is the median time of 5 runs:

Binding=True: 9.063s
Binding=False: 8.658s

So this shows again that PEP 580 improves performance in actual 
real-world use cases.


[1] https://mail.python.org/pipermail/python-dev/2018-July/154740.html
[2] https://github.com/lepture/mistune
[3] https://github.com/jdemeyer/mistune/tree/cython_pxd
[4] https://github.com/jdemeyer/mistune/tree/cython_pxd_nobinding

More information about the Python-Dev mailing list