subscriber: rm crossbeam-utils, make parking_lot opt-in #348
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The
tracing-subscriber
currently depends on both thecrossbeam-util
crate (for its
ShardedLock
type) and theparking_lot
crate for it'sRwLock
implementation. The Rust standard library also provides aRwLock
implementation, so these external dependencies are not strictlynecessary. In the past, using these crates was anecdotally observed to
result in a performance improvement, but the tradeoff is adding
additonal crates (and their transitive dependencies) to the user's
dependency tree.
Solution
This branch removes the
crossbeam-util
dependency, and makes theparking_lot
dependency opt-in. The explicit use ofparking_lot::RwLock
with a wrapper type that abstracts over theparking_lot::RwLock
andstd::sync::RwLock
types to provide amatching API. This allows the
parking_lot
feature flag totransparently replace the use of
std::sync::RwLock
withparking_lot
,rather than making it required for other features.