diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-20 21:04:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-20 21:04:14 +0200 |
| commit | c2ed68523864991dd94179972578646d33eccdaf (patch) | |
| tree | 0cfc8f05e6652a9491201760bdfb83ad2eed346e | |
| parent | 2cded97c963ae15dda17ff5e3111cde4abfa592d (diff) | |
| parent | 880d565df1590b01ba9b7b38145692069d43f4cc (diff) | |
| download | rust-c2ed68523864991dd94179972578646d33eccdaf.tar.gz rust-c2ed68523864991dd94179972578646d33eccdaf.zip | |
Rollup merge of #131973 - jalil-salame:rustdoc-types-document-feature, r=aDotInTheVoid
fix(rustdoc-json-types): document rustc-hash feature The `rustc-hash` feature is publicly exposed by the `rustdoc-types`. It is already documented in that crate's README and Cargo.toml, but we might as well add some information to the crate docs themselves c: Follow up to: - #131936 - [rust-lang/rustdoc-types#42][1] [1]: https://github.com/rust-lang/rustdoc-types/pull/42 r? `@aDotInTheVoid`
| -rw-r--r-- | src/rustdoc-json-types/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index c4e142342a8..33ec59dad5b 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -2,6 +2,18 @@ //! //! These types are the public API exposed through the `--output-format json` flag. The [`Crate`] //! struct is the root of the JSON blob and all other items are contained within. +//! +//! We expose a `rustc-hash` feature that is disabled by default. This feature switches the +//! [`std::collections::HashMap`] for [`rustc_hash::FxHashMap`] to improve the performance of said +//! `HashMap` in specific situations. +//! +//! `cargo-semver-checks` for example, saw a [-3% improvement][1] when benchmarking using the +//! `aws_sdk_ec2` JSON output (~500MB of JSON). As always, we recommend measuring the impact before +//! turning this feature on, as [`FxHashMap`][2] only concerns itself with hash speed, and may +//! increase the number of collisions. +//! +//! [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types/near/474855731 +//! [2]: https://crates.io/crates/rustc-hash #[cfg(not(feature = "rustc-hash"))] use std::collections::HashMap; |
