-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rustdoc-json-types): introduce rustc-hash feature #131936
Conversation
This allows the public `rustdoc-types` crate to expose this feature easily and allows consumers of the crate to get the performance advantages from doing so. The reasoning for this was discussed on [Zulip][1] Changes: - Make `rustc-hash` optional but default to including it - Rename all occurrences of `FxHashMap` to `HashMap`. - Feature gate the import and rename the imported `FxHashMap` to `HashMap` - Introduce a type alias `FxHashMap` which resolves to the currently used `HashMap` (`rustc_hash::FxHashMap` or `std::collections::HashMap`) for use in `src/librustdoc`. [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aDotInTheVoid (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing |
Changes in preparation of [rust-lang/rust#131936][1]: - Introduce `rustc-hash` dependency and feature. - Modify the `update.sh` script accordingly. [1]: rust-lang/rust#131936
Thanks for working on this! @bors r+ rollup |
…iaskrgr Rollup of 12 pull requests Successful merges: - rust-lang#116863 (warn less about non-exhaustive in ffi) - rust-lang#127675 (Remove invalid help diagnostics for const pointer) - rust-lang#131772 (Remove `const_refs_to_static` TODO in proc_macro) - rust-lang#131789 (Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax) - rust-lang#131795 (Stop inverting expectation in normalization errors) - rust-lang#131920 (Add codegen test for branchy bool match) - rust-lang#131921 (replace STATX_ALL with (STATX_BASIC_STATS | STATX_BTIME) as former is deprecated) - rust-lang#131925 (Warn on redundant `--cfg` directive when revisions are used) - rust-lang#131931 (Remove unnecessary constness from `lower_generic_args_of_path`) - rust-lang#131932 (use tracked_path in rustc_fluent_macro) - rust-lang#131936 (feat(rustdoc-json-types): introduce rustc-hash feature) - rust-lang#131939 (Get rid of `OnlySelfBounds`) Failed merges: - rust-lang#131181 (Compiletest: Custom differ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131936 - jalil-salame:rustdoc-types-rustc-hash, r=aDotInTheVoid feat(rustdoc-json-types): introduce rustc-hash feature This allows the public `rustdoc-types` crate to expose this feature easily and allows consumers of the crate to get the performance advantages from doing so. The reasoning for this was discussed on [Zulip][1] Changes: - Make `rustc-hash` optional but default to including it - Rename all occurrences of `FxHashMap` to `HashMap`. - Feature gate the import and rename the imported `FxHashMap` to `HashMap` - Introduce a type alias `FxHashMap` which resolves to the currently used `HashMap` (`rustc_hash::FxHashMap` or `std::collections::HashMap`) for use in `src/librustdoc`. [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types **extra context from the zulip thread:** - `@obi1kenobi` requested benchmarks of the switch to `rustc-hash` - I benchmarked switching `rustdoc-types` to `rustc-hash` which yielded a ~300ms improvement to `cargo-semver-checks`'s index building step (this step is done twice so the improvements are ~150ms per index). - The benchmarks were presented in Zulip and people were in favor of introducing `rustc-hash` to the public `rustdoc-types` crate. - There were differing opinions on how to introduce the dependency: 1. "Hard" dependency: remove use of `std::collections::HashMap` in favor of `FxHashMap`. 2. "Soft" dependency: make optional and introduce a feature then enable/disable it by default (this PR). 3. ~~Make `rustdoc-types` generic and expose the `RandomState`~~ (a lot of work & complexity for little gain over a feature gate). `@obi1kenobi` and I prefer the feature gate so that is what I am adding here. My reasons for the preference are: - `cargo-semver-checks` is especially perf sensitive, we don't expect people to care about ~150ms extra time when reading in a 500MB file (the size of the sample we used for benchmarking). - Keeping `rustdoc-types` lean by having its only direct dependency be `serde` is nice for the general consumer of the crate. - `rustc-hash` is not HashDOS resistant (but it is questionable whether `rustdoc-types` would be used on adversarial inputs). r? `@aDotInTheVoid`
Changes in preparation of [rust-lang/rust#131936][1]: - Introduce `rustc-hash` dependency and feature. - Modify the `update.sh` script accordingly. [1]: rust-lang/rust#131936
Changes in preparation of [rust-lang/rust#131936][1]: - Introduce `rustc-hash` dependency and feature. - Modify the `update.sh` script accordingly. [1]: rust-lang/rust#131936
* feat: add rustc-hash feature Changes in preparation of [rust-lang/rust#131936][1]: - Introduce `rustc-hash` dependency and feature. - Modify the `update.sh` script accordingly. [1]: rust-lang/rust#131936 * chore: run ./update.sh * feat(ci): also test with the `rustc-hash` feature * README reword --------- Co-authored-by: Alona Enraght-Moony <code@alona.page>
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: - rust-lang#131936 - [rust-lang/rustdoc-types#42][1] [1]: rust-lang/rustdoc-types#42
…t-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: - rust-lang#131936 - [rust-lang/rustdoc-types#42][1] [1]: rust-lang/rustdoc-types#42 r? `@aDotInTheVoid`
Rollup merge of rust-lang#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: - rust-lang#131936 - [rust-lang/rustdoc-types#42][1] [1]: rust-lang/rustdoc-types#42 r? `@aDotInTheVoid`
This allows the public
rustdoc-types
crate to expose this feature easily and allows consumers of the crate to get the performance advantages from doing so.The reasoning for this was discussed on Zulip
Changes:
rustc-hash
optional but default to including itFxHashMap
toHashMap
.FxHashMap
toHashMap
FxHashMap
which resolves to the currently usedHashMap
(rustc_hash::FxHashMap
orstd::collections::HashMap
) for use insrc/librustdoc
.extra context from the zulip thread:
rustc-hash
rustdoc-types
torustc-hash
which yielded a ~300ms improvement tocargo-semver-checks
's index building step (this step is done twice so the improvements are ~150ms per index).rustc-hash
to the publicrustdoc-types
crate.std::collections::HashMap
in favor ofFxHashMap
.Make(a lot of work & complexity for little gain over a feature gate).rustdoc-types
generic and expose theRandomState
@obi1kenobi and I prefer the feature gate so that is what I am adding here.
My reasons for the preference are:
cargo-semver-checks
is especially perf sensitive, we don't expect people to care about ~150ms extra time when reading in a 500MB file (the size of the sample we used for benchmarking).rustdoc-types
lean by having its only direct dependency beserde
is nice for the general consumer of the crate.rustc-hash
is not HashDOS resistant (but it is questionable whetherrustdoc-types
would be used on adversarial inputs).r? @aDotInTheVoid