Skip to content
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: add feature to use rustc-hash (#423) #446

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ readme = "./README.md"
trustfall = "0.7.1"
rustdoc-types = "0.25.0"
rayon = { version = "1.10.0", optional = true }
rustc-hash = { version = "2.0.0", optional = true }

[features]
default = []
# Enable rayon for speeding up building `IndexedCrate`, this massively improves
# performance on big crates, but may impact performance on small crates and
# definitely increases the memory usage
rayon = ["dep:rayon"]
# Use rustc-hash::{FxHashMap, FxHashSet} internally for improved performance
rustc-hash = ["dep:rustc-hash"]

[[bench]]
name = "indexed_crate"
Expand Down
3 changes: 3 additions & 0 deletions src/visibility_tracker.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(feature = "rustc-hash")]
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
#[cfg(not(feature = "rustc-hash"))]
use std::collections::{HashMap, HashSet};

use rustdoc_types::{Crate, GenericArgs, Id, Item, ItemEnum, TypeAlias, Visibility};
Expand Down