diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-07-24 06:11:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 06:11:25 +0000 |
commit | 7b9f32300ee0a249c0872302c97635b460e45ba5 (patch) | |
tree | ae6dacdcdb74f32d949a707913c3fdac048cd00a /alacritty/src/event.rs | |
parent | d20cce9401b2d449ee39013da3eb5f0f66a39c98 (diff) | |
download | r-alacritty-7b9f32300ee0a249c0872302c97635b460e45ba5.tar.gz r-alacritty-7b9f32300ee0a249c0872302c97635b460e45ba5.tar.bz2 r-alacritty-7b9f32300ee0a249c0872302c97635b460e45ba5.zip |
Use ahash instead of fnv and regular hash function
After evaluation of the ahash with the data alacritty uses it was
discovered that it's 1.5-2x times faster when getting the already
hashed values, which is the primary cases for alacritty's renderer.
Given that ahash is generally faster, all the HashSet and HashMap's
inside the alacritty were changed to use it as a hasher function.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r-- | alacritty/src/event.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 426b207e..0ffc46a0 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -14,6 +14,7 @@ use std::sync::atomic::Ordering; use std::time::{Duration, Instant}; use std::{env, f32, mem}; +use ahash::RandomState; use log::{debug, error, info, warn}; #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] use wayland_client::{Display as WaylandDisplay, EventQueue}; @@ -1044,7 +1045,7 @@ pub enum TouchPurpose { Scroll(TouchEvent), Zoom(TouchZoom), Tap(TouchEvent), - Invalid(HashSet<u64>), + Invalid(HashSet<u64, RandomState>), } impl Default for TouchPurpose { @@ -1085,8 +1086,8 @@ impl TouchZoom { } /// Get active touch slots. - pub fn slots(&self) -> HashSet<u64> { - let mut set = HashSet::new(); + pub fn slots(&self) -> HashSet<u64, RandomState> { + let mut set = HashSet::default(); set.insert(self.slots.0.id); set.insert(self.slots.1.id); set @@ -1401,7 +1402,7 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { pub struct Processor { #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] wayland_event_queue: Option<EventQueue>, - windows: HashMap<WindowId, WindowContext>, + windows: HashMap<WindowId, WindowContext, RandomState>, cli_options: CliOptions, config: Rc<UiConfig>, } @@ -1423,7 +1424,7 @@ impl Processor { }); Processor { - windows: HashMap::new(), + windows: Default::default(), config: Rc::new(config), cli_options, #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))] |