Auto merge of #78448 - rylev:cache-foreign_modules, r=wesleywiser
foreign_modules query hash table lookups When compiling a large monolithic crate we're seeing huge times in the `foreign_modules` query due to repeated iteration over foreign modules (in order to find a module by its id). This implements hash table lookups so that which massively reduces time spent in that query in this particular case. We'll need to see if the overhead of creating the hash table has a negative impact on performance in more normal compilation scenarios. I'm working with `@wesleywiser` on this.
This commit is contained in:
commit
7b5a9e9cd2
7 changed files with 17 additions and 14 deletions
|
@ -860,8 +860,6 @@ pub fn provide_both(providers: &mut Providers) {
|
|||
|
||||
providers.dllimport_foreign_items = |tcx, krate| {
|
||||
let module_map = tcx.foreign_modules(krate);
|
||||
let module_map =
|
||||
module_map.iter().map(|lib| (lib.def_id, lib)).collect::<FxHashMap<_, _>>();
|
||||
|
||||
let dllimports = tcx
|
||||
.native_libraries(krate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue