Skip to content

Commit e8911f5

Browse files
committed
perf: Check for non-existing selectors
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
1 parent a77bf8c commit e8911f5

19 files changed

Lines changed: 254 additions & 74 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Performance
66

7+
- Skip selectors that reference non-existent classes, IDs, or tags.
78
- Faster HTML serialization for styles containing double quotes.
89

910
## [0.19.1] - 2026-01-23

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Benchmarks for `css-inline==0.19.0`:
273273
- Basic: **4.09 µs**, 230 bytes
274274
- Realistic-1: **78.94 µs**, 8.58 KB
275275
- Realistic-2: **48.56 µs**, 4.3 KB
276-
- GitHub page: **28.47 ms**, 1.81 MB
276+
- GitHub page: **16.78 ms**, 1.81 MB
277277

278278
These benchmarks, conducted using `rustc 1.91` on Ryzen 9 9950X, can be found in `css-inline/benches/inliner.rs`.
279279

bindings/c/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Performance
66

7+
- Skip selectors that reference non-existent classes, IDs, or tags.
78
- Faster HTML serialization for styles containing double quotes.
89

910
## [0.19.1] - 2026-01-23

bindings/java/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Performance
66

7+
- Skip selectors that reference non-existent classes, IDs, or tags.
78
- Faster HTML serialization for styles containing double quotes.
89

910
## [0.19.1] - 2026-01-23

bindings/java/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ Here is the performance comparison:
267267

268268
| | Size | `css-inline 0.19.0` | `CSSBox 5.0.0` |
269269
|-------------|---------|---------------------|-------------------------|
270-
| Basic | 230 B | 7.46 µs | 52.15 µs (**6.99x**) |
271-
| Realistic-1 | 8.58 KB | 111.38 µs | 1.64 ms (**14.69x**) |
272-
| Realistic-2 | 4.3 KB | 65.93 µs | 382.94 µs (**5.81x**) |
273-
| GitHub page | 1.81 MB | 42.86 ms | 315.65 ms (**7.37x**) |
270+
| Basic | 230 B | 7.22 µs | 53.33 µs (**7.38x**) |
271+
| Realistic-1 | 8.58 KB | 109.77 µs | 1.60 ms (**14.61x**) |
272+
| Realistic-2 | 4.3 KB | 61.92 µs | 381.42 µs (**6.16x**) |
273+
| GitHub page | 1.81 MB | 23.17 ms | 312.22 ms (**13.48x**) |
274274

275275
The benchmarking code is available in the `src/jmh/java/org/cssinline/CSSInlineBench.java` file. The benchmarks were conducted using the stable `rustc 1.91`, `OpenJDK 24.0.1` on Ryzen 9 9950X.
276276

bindings/javascript/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Performance
66

7+
- Skip selectors that reference non-existent classes, IDs, or tags.
78
- Faster HTML serialization for styles containing double quotes.
89

910
## [0.19.2] - 2026-01-23

bindings/javascript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Here is the performance comparison:
252252
| Basic | 230 B | 8.37 µs | 15.96 µs (**1.91x**) | 42.32 µs (**5.06x**) | 80.85 µs (**9.66x**) |
253253
| Realistic-1 | 8.58 KB | 168.95 µs | 344.59 µs (**2.04x**)| 524.38 µs (**3.10x**) | 1.15 ms (**6.78x**) |
254254
| Realistic-2 | 4.3 KB | 90.36 µs | 180.31 µs (**2.00x**)| 634.52 µs (**7.02x**) | 898.47 µs (**9.94x**) |
255-
| GitHub page | 1.81 MB | 62.31 ms | 117.81 ms (**1.89x**)| 1.55 s (**24.82x**) | 312.54 ms (**5.02x**) |
255+
| GitHub page | 1.81 MB | 32.73 ms | 119.60 ms (**3.65x**)| 1.60 s (**48.90x**) | 326.41 ms (**9.97x**) |
256256

257257
The "Basic" case was obtained from benchmarking the example from the Usage section.
258258

bindings/javascript/js-binding.js

Lines changed: 52 additions & 52 deletions
Large diffs are not rendered by default.

bindings/php/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Performance
66

7+
- Skip selectors that reference non-existent classes, IDs, or tags.
78
- Faster HTML serialization for styles containing double quotes.
89

910
## [0.19.1] - 2026-01-23

bindings/php/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Here is the performance comparison:
281281
| Simple | 230 B | 5.69 µs | 26.22 µs (**4.61x**) | 134.37 µs (**23.61x**) |
282282
| Realistic email 1 | 8.58 KB | 94.07 µs | 288.20 µs (**3.06x**) | 588.00 µs (**6.25x**) |
283283
| Realistic email 2 | 4.3 KB | 58.15 µs | 585.24 µs (**10.07x**) | 2.24 ms (**38.58x**) |
284-
| GitHub Page† | 1.81 MB | 37.72 ms | ERROR | ERROR |
284+
| GitHub Page† | 1.81 MB | 24.78 ms | ERROR | ERROR |
285285

286286
† The GitHub page benchmark contains complex modern CSS that neither `css-to-inline-styles` nor `emogrifier` can process.
287287

0 commit comments

Comments
 (0)