diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-03 22:47:39 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-03 22:47:39 +0100 |
commit | a3dc04905b4c1a88ece9cc252bfbf9e321f29428 (patch) | |
tree | f671f0e97d91f9392f90911ebcb62df8eea958ea /crates/hir_def/src/nameres | |
parent | b78f1a0a4d90276c7bd99bd0e5ac6959578be76a (diff) | |
parent | d1bce6070def3b4d5045c3fc4bb66904d50d0a40 (diff) |
Merge #8318
8318: Use shrink_to_fit to reduce DefMap sizes r=jonas-schievink a=jonas-schievink
Especially `block_def_map` can overallocate when there's not a lot of items in the `DefMap`. This saves around 10 MB during analysis-stats. Not too much, but a cheap win.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/nameres')
-rw-r--r-- | crates/hir_def/src/nameres/collector.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index c2e445b68..4ddc791ce 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs | |||
@@ -109,7 +109,9 @@ pub(super) fn collect_defs( | |||
109 | } | 109 | } |
110 | } | 110 | } |
111 | collector.collect(); | 111 | collector.collect(); |
112 | collector.finish() | 112 | let mut def_map = collector.finish(); |
113 | def_map.shrink_to_fit(); | ||
114 | def_map | ||
113 | } | 115 | } |
114 | 116 | ||
115 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] | 117 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] |