brave / adblock-rust

Brave's Rust-based adblock engine
Mozilla Public License 2.0
1.46k stars 124 forks source link

Better concurrency support #390

Open Ambyjkl opened 2 months ago

Ambyjkl commented 2 months ago

Hello, I want to use adblock-rust in a setup where concurrency would be beneficial. Although disabling object-pooling and unsync-regex-caching is enough to make Engine Send + Sync, there is still work to be done to actually make concurrent usage efficient. Hence, I want to contribute towards this goal, here is what I'm planing to do:

Please let me know your thoughts

Ambyjkl commented 2 months ago

On second thought, time-based eviction is probably not the best idea; we don't lose much by leaving the compiled regex in the cache, since recompiling can be expensive. Also, Instant is not available on wasm32-unknown-unknown. Considering this, I think quick_cache (https://crates.io/crates/quick_cache/0.6.5) is a better fit.