Skip to content

Commit d7195e1

Browse files
committed
docs(python): Update benchmark data & add toronado
1 parent abd3ebf commit d7195e1

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

bindings/python/README.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,23 @@ Performance
7979
-----------
8080

8181
Due to the usage of efficient tooling from Mozilla's Servo project (``html5ever``, ``rust-cssparser`` and others) this
82-
library has excellent performance characteristics. In comparison with other Python projects, it is ~9-18x faster than the nearest alternative.
82+
library has excellent performance characteristics. In comparison with other Python projects, it is ~9-21x faster than the nearest alternative.
8383

8484
For inlining CSS in the html document from the ``Usage`` section above we have the following breakdown in our benchmarks:
8585

86-
- ``css_inline 0.7.0`` - 21.94 us
87-
- ``premailer 3.7.0`` - 403.48 us (**x18.39**)
88-
- ``inlinestyler 0.2.4`` - 2.84 ms (**x129.44**)
89-
- ``pynliner 0.8.0`` - 3.34 ms (**x152.23**)
86+
- ``css_inline 0.7.8`` - 21.76 us
87+
- ``premailer 3.10.0`` - 461.54 us (**x21.21**)
88+
- ``toronado 0.1.0`` - 1.87 ms (**x85.93**)
89+
- ``inlinestyler 0.2.4`` - 2.85 ms (**x130.97**)
90+
- ``pynliner 0.8.0`` - 3.34 ms (**x153.49**)
9091

9192
And for a more realistic email:
9293

93-
- ``css_inline 0.7.7`` - 446.8 us
94-
- ``premailer 3.7.0`` - 4.10 ms (**x9.18**)
95-
- ``inlinestyler 0.2.4`` - 75.71 ms (**x169.43**)
96-
- ``pynliner 0.8.0`` - 124.13 ms (**x277.78**)
94+
- ``css_inline 0.7.8`` - 433.39 us
95+
- ``premailer 3.10.0`` - 3.9 ms (**x9.01**)
96+
- ``toronado 0.1.0`` - 43.89 ms (**x101.27**)
97+
- ``inlinestyler 0.2.4`` - 75.77 ms (**x174.83**)
98+
- ``pynliner 0.8.0`` - 123.6 ms (**x285.19**)
9799

98100
You can take a look at the benchmarks' code at ``benches/bench.py`` file.
99101
The results above were measured with stable ``rustc 1.57.0``, ``Python 3.9.9`` on i8700K, and 32GB RAM.

bindings/python/benches/bench.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import premailer
66
import pynliner
77
import pytest
8+
import toronado
89

910
import css_inline
1011

@@ -151,7 +152,7 @@
151152

152153

153154
def parametrize_functions(
154-
*funcs, ids=("css_inline", "premailer", "pynliner", "inlinestyler")
155+
*funcs, ids=("css_inline", "premailer", "pynliner", "inlinestyler", "toronado")
155156
):
156157
return pytest.mark.parametrize("func", funcs, ids=ids)
157158

@@ -161,6 +162,7 @@ def parametrize_functions(
161162
premailer.transform,
162163
pynliner.fromString,
163164
inlinestyler.utils.inline_css,
165+
toronado.from_string,
164166
)
165167

166168

@@ -174,7 +176,15 @@ def parallel(func):
174176
parallel(premailer.transform),
175177
parallel(pynliner.fromString),
176178
parallel(inlinestyler.utils.inline_css),
177-
ids=("css_inline", "css_inline_pyprocess", "premailer", "pynliner", "inlinestyler"),
179+
parallel(toronado.from_string),
180+
ids=(
181+
"css_inline",
182+
"css_inline_pyprocess",
183+
"premailer",
184+
"pynliner",
185+
"inlinestyler",
186+
"toronado",
187+
),
178188
)
179189

180190

0 commit comments

Comments
 (0)