1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 06:54:45 +03:00

fonts: pre-size some vecs

micro optimization really
This commit is contained in:
Wez Furlong 2021-04-27 22:39:32 -07:00
parent a2b068d59f
commit 8953bff276
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ where
infos: &[GlyphInfo],
glyphs: &[Rc<CachedGlyph<T>>],
) -> Vec<ShapedInfo<T>> {
let mut pos: Vec<Option<ShapedInfo<T>>> = vec![];
let mut pos: Vec<Option<ShapedInfo<T>>> = Vec::with_capacity(infos.len());
let mut x = 0.;
let mut prior_info: Option<&GlyphInfo> = None;

View File

@ -1275,7 +1275,7 @@ impl super::TermWindow {
glyph_cache: &mut GlyphCache<SrgbTexture2d>,
infos: &[GlyphInfo],
) -> anyhow::Result<Vec<Rc<CachedGlyph<SrgbTexture2d>>>> {
let mut glyphs = vec![];
let mut glyphs = Vec::with_capacity(infos.len());
for info in infos {
let cell_idx = cluster.byte_to_cell_idx[info.cluster as usize];
let followed_by_space = match line.cells().get(cell_idx + 1) {