Use an FxHashMap in RegDiversions.
Because it's hot and the number of entries can reach the 1000s, so linear insertion and search is bad. This reduces runtime for `sqlite` and `UE4Game-HTML5-Shipping` by 3-4%, and a couple of other benchmarks (`sqlite`, `godot`, `clang`) by smaller amounts. It also increases runtime for `mono` and `tanks` by about 1%; this seems to be due to incidental changes in which functions are inlined more than algorithmic changes.
This commit is contained in:
committed by
Dan Gohman
parent
c9666381f6
commit
46d9a3cd1a
@@ -97,6 +97,7 @@ where
|
||||
}
|
||||
|
||||
/// Resize the map to have `n` entries by adding default entries as needed.
|
||||
#[inline]
|
||||
pub fn resize(&mut self, n: usize) {
|
||||
self.elems.resize(n, self.default.clone());
|
||||
}
|
||||
@@ -125,6 +126,7 @@ where
|
||||
K: EntityRef,
|
||||
V: Clone,
|
||||
{
|
||||
#[inline]
|
||||
fn index_mut(&mut self, k: K) -> &mut V {
|
||||
let i = k.index();
|
||||
if i >= self.elems.len() {
|
||||
|
||||
Reference in New Issue
Block a user