chore: 🤖 make parking_lot dependency optional - #265
Conversation
|
Here is the benchmark for current |
|
☔ The latest upstream changes (presumably #268) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Closing as I don’t think we should have a feature flag for this. Let’s pick one mutex implementation, unless somehow two of them have very good reasons to be chosen in different sitatuions. I’d consider another PR to switch unconditionally to In particular, I think the "extreme contention" benchmark from rust-lang/rust#95035 (comment) is unlikely to be relevant: we choose between 4096 different mutices based on a string hash, so as far as I can tell contention would only happen if many threads keep interning the very same string and doing nothing else. Possibly, wrapping these mutices in https://docs.rs/crossbeam-utils/latest/crossbeam_utils/struct.CachePadded.html might help. (Though it’d cost 480 KiB more memory.) That would be nice to try as well if someone makes benchmarks. |
Summary
parking_lotis not always the best choice after rust stable 1.62 https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html#thinner-faster-mutexes-on-linuxparking_lotan optional dependencyparking_lot_supportto let user enable the optional dependencyparking_lotparking_lot_supportto the default_features list to avoid breaking changes.