perf: use rustc-hash for HashMap and HashSet
Since we already depend on `rustc-hash` transiently, this doesn't add any more dependencies. As long as DOS attacks aren't a concern (which I don't think they are?), this should be free performance. In my (admittedly naive) testing, this really improved CPU usage in some cases, which is pretty nice to get for free.
This commit is contained in:
parent
4be92ae8ca
commit
43a9fca4ec
11 changed files with 68 additions and 68 deletions
|
|
@ -2,8 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use mime_guess::Mime;
|
||||
use rustc_hash::FxHashMap;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
path::Path,
|
||||
process,
|
||||
|
|
@ -56,13 +56,13 @@ impl Thumbnailer {
|
|||
}
|
||||
|
||||
pub struct ThumbnailerCache {
|
||||
cache: HashMap<Mime, Vec<Thumbnailer>>,
|
||||
cache: FxHashMap<Mime, Vec<Thumbnailer>>,
|
||||
}
|
||||
|
||||
impl ThumbnailerCache {
|
||||
pub fn new() -> Self {
|
||||
let mut thumbnailer_cache = Self {
|
||||
cache: HashMap::new(),
|
||||
cache: FxHashMap::default(),
|
||||
};
|
||||
thumbnailer_cache.reload();
|
||||
thumbnailer_cache
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue