mirror of
https://github.com/wez/wezterm.git
synced 2024-11-14 03:16:09 +03:00
fonts: pre-size some vecs
micro optimization really
This commit is contained in:
parent
a2b068d59f
commit
8953bff276
@ -50,7 +50,7 @@ where
|
|||||||
infos: &[GlyphInfo],
|
infos: &[GlyphInfo],
|
||||||
glyphs: &[Rc<CachedGlyph<T>>],
|
glyphs: &[Rc<CachedGlyph<T>>],
|
||||||
) -> Vec<ShapedInfo<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 x = 0.;
|
||||||
let mut prior_info: Option<&GlyphInfo> = None;
|
let mut prior_info: Option<&GlyphInfo> = None;
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ impl super::TermWindow {
|
|||||||
glyph_cache: &mut GlyphCache<SrgbTexture2d>,
|
glyph_cache: &mut GlyphCache<SrgbTexture2d>,
|
||||||
infos: &[GlyphInfo],
|
infos: &[GlyphInfo],
|
||||||
) -> anyhow::Result<Vec<Rc<CachedGlyph<SrgbTexture2d>>>> {
|
) -> anyhow::Result<Vec<Rc<CachedGlyph<SrgbTexture2d>>>> {
|
||||||
let mut glyphs = vec![];
|
let mut glyphs = Vec::with_capacity(infos.len());
|
||||||
for info in infos {
|
for info in infos {
|
||||||
let cell_idx = cluster.byte_to_cell_idx[info.cluster as usize];
|
let cell_idx = cluster.byte_to_cell_idx[info.cluster as usize];
|
||||||
let followed_by_space = match line.cells().get(cell_idx + 1) {
|
let followed_by_space = match line.cells().get(cell_idx + 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user