1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00
alacritty/font
Joe Wilm 08f348ecea Optimize glyph cache access
Loading a glyph from the cache is a very hot operation in the renderer.
The original implementation would first check if a glyph was loaded and
then call `get()` which would have to search a second time. This showed
up as a very slow point in profiles.

This patch addresses glyph cache access in two ways: by using a faster
hasher optimized for small keys (fnv), and by using the entry API for
fetching a cached glyph. The `fnv` hasher is faster than the default and
is very efficient for small keys. Using the entry API on the HashMap
means only 1 lookup instead of two. The entry API has a downside where
the key needs to get cloned on fetches.

Reducing the GlyphKey width to 64-bits helps in both areas. Copying an
8-byte wide type is very cheap and thus limits downside of the entry
API. The small width also helps with the hasher performance.

Over all, this patch reduced typical render times by several hundred
microseconds on a 2013 MacBook Pro with a full screen terminal full of
text.
2017-01-26 08:43:53 -08:00
..
src Optimize glyph cache access 2017-01-26 08:43:53 -08:00
Cargo.lock Add ffi-util crate and use in fontconfig wrapper 2016-12-30 18:55:10 -08:00
Cargo.toml Use the log-crate instead of printing to stdout 2017-01-23 09:14:01 -08:00