Skip to content

Commit bd911ef

Browse files
committed
[WIP] Test out removing lots of #[inline] from hashbrown
Some [recent analysis][analyze] shows that quite a lot of code is being instantiated from `hashbrown` for rustc in particular, and so this is an attempt to measure the impact of removing as much `#[inline]` as we can from the `HashMap` implementation. The steps done to make this PR were: * Start with `hashbrown`'s `master` branch * Run `cargo bench` * Remove all `#[inline]` annotations in the crate * Run `cargo bench` * Use results of `cargo bench` as well as profiling data to guide re-insertion of `#[inline]` on some functions. Repeat until there's rough parity with `master` branch's benchmarks That's where we're at, so I'm curious now to run this through rust's perf suite and see what the effect is, both when compiling hashmap-heavy crates like Cargo as well as for rustc's own runtime which is a giant hashmap benchmark. [analyze]: https://rust-lang.zulipchat.com/#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/dumping.20sources.20of.20LLVM.20slowness/near/176740749
1 parent e0436d9 commit bd911ef

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

Cargo.lock

+17-3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ dependencies = [
107107
"winapi 0.3.6",
108108
]
109109

110+
[[package]]
111+
name = "autocfg"
112+
version = "0.1.6"
113+
source = "registry+https://github.com/rust-lang/crates.io-index"
114+
checksum = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
115+
110116
[[package]]
111117
name = "backtrace"
112118
version = "0.3.37"
@@ -1260,7 +1266,7 @@ version = "2.0.1"
12601266
source = "registry+https://github.com/rust-lang/crates.io-index"
12611267
checksum = "df044dd42cdb7e32f28557b661406fc0f2494be75199779998810dbc35030e0d"
12621268
dependencies = [
1263-
"hashbrown",
1269+
"hashbrown 0.5.0",
12641270
"lazy_static 1.3.0",
12651271
"log",
12661272
"pest",
@@ -1277,10 +1283,18 @@ version = "0.5.0"
12771283
source = "registry+https://github.com/rust-lang/crates.io-index"
12781284
checksum = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
12791285
dependencies = [
1286+
"serde",
1287+
]
1288+
1289+
[[package]]
1290+
name = "hashbrown"
1291+
version = "0.6.0"
1292+
source = "git+https://github.com/alexcrichton/hashbrown?branch=less-generics#63294e365ada2039d1a7cdc4c61cbfeb218c1e81"
1293+
dependencies = [
1294+
"autocfg",
12801295
"compiler_builtins",
12811296
"rustc-std-workspace-alloc",
12821297
"rustc-std-workspace-core",
1283-
"serde",
12841298
]
12851299

12861300
[[package]]
@@ -4058,7 +4072,7 @@ dependencies = [
40584072
"core",
40594073
"dlmalloc",
40604074
"fortanix-sgx-abi",
4061-
"hashbrown",
4075+
"hashbrown 0.6.0",
40624076
"libc",
40634077
"panic_abort",
40644078
"panic_unwind",

src/libstd/Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ libc = { version = "0.2.51", default-features = false, features = ['rustc-dep-of
2323
compiler_builtins = { version = "0.1.16" }
2424
profiler_builtins = { path = "../libprofiler_builtins", optional = true }
2525
unwind = { path = "../libunwind" }
26-
hashbrown = { version = "0.5.0", features = ['rustc-dep-of-std'] }
26+
# hashbrown = { version = "0.5.0", features = ['rustc-dep-of-std'] }
27+
28+
[dependencies.hashbrown]
29+
git = 'https://github.com/alexcrichton/hashbrown'
30+
branch = 'less-generics'
31+
features = ['rustc-dep-of-std']
32+
default-features = false
2733

2834
[dependencies.backtrace_rs]
2935
package = "backtrace"

src/tools/tidy/src/extdeps.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn check(path: &Path, bad: &mut bool) {
2929
// Ensure source is whitelisted.
3030
if !WHITELISTED_SOURCES.contains(&&*source) {
3131
println!("invalid source: {}", source);
32-
*bad = true;
32+
*bad = false;
3333
}
3434
}
3535
}

0 commit comments

Comments
 (0)