aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/renderer/text
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-07-24 06:11:25 +0000
committerGitHub <noreply@github.com>2023-07-24 06:11:25 +0000
commit7b9f32300ee0a249c0872302c97635b460e45ba5 (patch)
treeae6dacdcdb74f32d949a707913c3fdac048cd00a /alacritty/src/renderer/text
parentd20cce9401b2d449ee39013da3eb5f0f66a39c98 (diff)
downloadr-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/renderer/text')
-rw-r--r--alacritty/src/renderer/text/glyph_cache.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs
index 72415900..a750e4e7 100644
--- a/alacritty/src/renderer/text/glyph_cache.rs
+++ b/alacritty/src/renderer/text/glyph_cache.rs
@@ -1,11 +1,10 @@
use std::collections::HashMap;
-use std::hash::BuildHasherDefault;
+use ahash::RandomState;
use crossfont::{
Error as RasterizerError, FontDesc, FontKey, GlyphKey, Metrics, Rasterize, RasterizedGlyph,
Rasterizer, Size, Slant, Style, Weight,
};
-use fnv::FnvHasher;
use log::{error, info};
use unicode_width::UnicodeWidthChar;
@@ -46,7 +45,7 @@ pub struct Glyph {
/// representations of the same code point.
pub struct GlyphCache {
/// Cache of buffered glyphs.
- cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>,
+ cache: HashMap<GlyphKey, Glyph, RandomState>,
/// Rasterizer for loading new glyphs.
rasterizer: Rasterizer,
@@ -91,7 +90,7 @@ impl GlyphCache {
let metrics = rasterizer.metrics(regular, font.size())?;
Ok(Self {
- cache: HashMap::default(),
+ cache: Default::default(),
rasterizer,
font_size: font.size(),
font_key: regular,