Use FxHashMap and FxHashSet in hot code paths

We can also use these maps and sets in place of `SeaHasher` because
they are also deterministic. Note that we're not swapping std's
`HashMap` and `HashSet` wholesale inside of `collections` because
on the server we need cryptographically secure collections.
This commit is contained in:
Antonio Scandurra
2023-12-12 13:35:22 +01:00
parent 385c830bef
commit b871f906d6
8 changed files with 40 additions and 52 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ use crate::{
Point, Size,
};
use anyhow::Result;
use collections::HashMap;
use collections::FxHashMap;
use derive_more::{Deref, DerefMut};
use etagere::BucketedAtlasAllocator;
use metal::Device;
@@ -53,7 +53,7 @@ struct MetalAtlasState {
monochrome_textures: Vec<MetalAtlasTexture>,
polychrome_textures: Vec<MetalAtlasTexture>,
path_textures: Vec<MetalAtlasTexture>,
tiles_by_key: HashMap<AtlasKey, AtlasTile>,
tiles_by_key: FxHashMap<AtlasKey, AtlasTile>,
}
impl PlatformAtlas for MetalAtlas {