cloudflare / lol-html

Low output latency streaming HTML parser/rewriter with CSS selector-based API
https://crates.io/crates/lol-html
BSD 3-Clause "New" or "Revised" License
1.47k stars 82 forks source link

Send parameterizable rewriter #224

Closed orium closed 1 month ago

orium commented 1 month ago

Some data structures had to be turned into Sync to make the rewriter Send (if the handlers are Send). This has a performance penalty even when using a non-Send rewriter.

The benchmarks have a median slowdown of -0.8%. You read that right: a negative slowdown, which is a speedup. This can only be explained by noise while running the benchmarks, as they can only get slightly slower, not faster. However, it shows that the performance change is negligible (in my x86 machine, at least).