You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 EngineSend + 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:
Use a thread-local variable for the request_tokens vector
I believe this solution might even outperform the object pooling implementation, and hence eliminate the need for the lifeguard dependency
Use a concurrent cache rather than a mutexed hashmap
While I have not used any concurrent cache other than redis (dashmap doesn't count as it doesn't have eviction support) in previous projects, after a bit of research, mini-moka (https://crates.io/crates/mini-moka) in particular caught my attention, since it has all the features we need while also providing a non-thread-safe implementation for the single-threaded case, so there can be high code reuse, while also being the sibling of moka which is battle-tested in production on crates.io itself
Please let me know your thoughts
The text was updated successfully, but these errors were encountered:
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.
Hello,
I want to use adblock-rust in a setup where concurrency would be beneficial. Although disabling
object-pooling
andunsync-regex-caching
is enough to makeEngine
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:request_tokens
vectorlifeguard
dependencydashmap
doesn't count as it doesn't have eviction support) in previous projects, after a bit of research,mini-moka
(https://crates.io/crates/mini-moka) in particular caught my attention, since it has all the features we need while also providing a non-thread-safe implementation for the single-threaded case, so there can be high code reuse, while also being the sibling ofmoka
which is battle-tested in production on crates.io itselfPlease let me know your thoughts
The text was updated successfully, but these errors were encountered: