From bc410c4261f12377a2eb7ea08f4112a1a9574a77 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 21 Apr 2026 18:00:59 +0300 Subject: perf: reduce headless server render overhead --- src/ghostty/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/ghostty') diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs index e236b36f..75e600b8 100644 --- a/src/ghostty/mod.rs +++ b/src/ghostty/mod.rs @@ -1121,10 +1121,17 @@ impl<'a> RowCellIter<'a> { } pub fn graphemes(&self) -> Result, Error> { + let mut out = Vec::new(); + self.graphemes_into(&mut out)?; + Ok(out) + } + + pub fn graphemes_into(&self, out: &mut Vec) -> Result<(), Error> { let len = self.grapheme_len()? as usize; - let mut out = vec![0u32; len]; + out.clear(); + out.resize(len, 0); if len == 0 { - return Ok(out); + return Ok(()); } // SAFETY: out buffer is allocated for the grapheme count returned by the API. unsafe { @@ -1135,7 +1142,7 @@ impl<'a> RowCellIter<'a> { ) .into_result()?; } - Ok(out) + Ok(()) } } -- cgit v1.2.3