Skip to content

Commit 62d785d

Browse files
committed
chore: Add extra benchmark for Python
It demonstrates that Rust-level threading is more efficient than Python-level multiprocessing (threading is much slower due to GIL)
1 parent 0d2ea1e commit 62d785d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/benches/bench.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@
150150
REALISTIC_HTMLS = [REALISTIC_HTML] * 100
151151

152152

153-
def parametrize_functions(*funcs):
154-
return pytest.mark.parametrize("func", funcs, ids=["css_inline", "premailer", "pynliner", "inlinestyler"])
153+
def parametrize_functions(*funcs, ids=("css_inline", "premailer", "pynliner", "inlinestyler")):
154+
return pytest.mark.parametrize("func", funcs, ids=ids)
155155

156156

157157
all_functions = parametrize_functions(
@@ -165,9 +165,11 @@ def parallel(func):
165165

166166
all_many_functions = parametrize_functions(
167167
css_inline.inline_many,
168+
parallel(css_inline.inline),
168169
parallel(premailer.transform),
169170
parallel(pynliner.fromString),
170171
parallel(inlinestyler.utils.inline_css),
172+
ids=("css_inline", "css_inline_pyprocess", "premailer", "pynliner", "inlinestyler"),
171173
)
172174

173175

0 commit comments

Comments
 (0)