Skip to content

Commit e483dc1

Browse files
committed
chore: Update benchmarks
1 parent 03174f7 commit e483dc1

File tree

2 files changed

+369
-21
lines changed

2 files changed

+369
-21
lines changed

bindings/python/README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,45 @@ Performance
113113
-----------
114114

115115
Due to the usage of efficient tooling from Mozilla's Servo project (`html5ever`, `rust-cssparser` and others) this
116-
library has excellent performance characteristics. In comparison with other Python projects, it is ~7-15x faster than the nearest alternative.
116+
library has excellent performance characteristics. In comparison with other Python projects, it is usually >10x faster than the nearest alternative.
117117

118118
For inlining CSS in the html document from the `Usage` section above there is the following breakdown in the benchmarks:
119119

120-
- `css_inline 0.8.2` - 21.75 us
121-
- `premailer 3.10.0` - 329.51 us (**x15.14**)
122-
- `toronado 0.1.0` - 1.59 ms (**x73.28**)
123-
- `inlinestyler 0.2.5` - 2.37 ms (**x109.27**)
124-
- `pynliner 0.8.0` - 2.78 ms (**x127.89**)
120+
- `css_inline 0.8.2` - 22.42 us
121+
- `premailer 3.10.0` - 332.02 us (**x14.81**)
122+
- `toronado 0.1.0` - 1.59 ms (**x71.17**)
123+
- `inlinestyler 0.2.5` - 2.35 ms (**x105.07**)
124+
- `pynliner 0.8.0` - 2.79 ms (**x124.80**)
125125

126-
And for a more realistic email:
126+
Realistic email 1:
127127

128-
- `css_inline 0.8.2` - 443.83 us
129-
- `premailer 3.10.0` - 3.25 ms (**x7.33**)
130-
- `toronado 0.1.0` - 35.35 ms (**x79.65**)
131-
- `inlinestyler 0.2.5` - 61.08 ms (**x137.62**)
132-
- `pynliner 0.8.0` - 99.52 ms (**x224.24**)
128+
- `css_inline 0.8.2` - 487.75 us
129+
- `premailer 3.10.0` - 3.92 ms (**x8.05**)
130+
- `toronado 0.1.0` - 52.09 ms (**x106.81**)
131+
- `inlinestyler 0.2.5` - 81.17 ms (**x166.43**)
132+
- `pynliner 0.8.0` - 128.81 ms (**x264.1**)
133+
134+
Realistic email 2:
135+
136+
- `css_inline 0.8.2` - 386.64 us
137+
- `premailer 3.10.0` - 4.82 ms (**x12.47**)
138+
- `toronado 0.1.0` - `Error: Pseudo-elements are not supported`
139+
- `inlinestyler 0.2.5` - 40.80 ms (**x105.54**)
140+
- `pynliner 0.8.0` - `Error: No match was found`
133141

134142
You can take a look at the benchmarks' code at `benches/bench.py` file.
135-
The results above were measured with stable `rustc 1.61.0`, `Python 3.10.4`, `Linux x86_64` on i8700K, and 32GB RAM.
143+
The results above were measured with stable `rustc 1.64.0`, `Python 3.10.4`, `Linux x86_64` on i8700K, and 32GB RAM.
144+
145+
Comparison with other libraries
146+
-------------------------------
147+
148+
Besides performance, `css-inline` differs from other Python libraries for CSS inlining.
149+
150+
- Generally supports more CSS features than other libraries (for example, `toronado` and `pynliner` do not support pseudo-elements);
151+
- It has fewer configuration options and not as flexible as `premailer`;
152+
- Works on fewer platforms than LXML-based libraries (`premailer`, `inlinestyler`, `toronado`, and optionally `pynliner`);
153+
- Does not have debug logs yet;
154+
- Supports only HTML 5.
136155

137156
Python support
138157
--------------

0 commit comments

Comments
 (0)