Skip to content

Commit b4ca4a4

Browse files
committed
perf: Avoid allocation for appending text when writing it to stdout
1 parent 3c21346 commit b4ca4a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/utils/display/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ pub fn draw_append_text(
206206
if num_appendable >= 1 {
207207
crossterm::execute!(out, crossterm::terminal::Clear(ClearType::CurrentLine))?;
208208
}
209-
write!(out, "{}", fmt_text[0..num_appendable].join("\n\r"))?;
209+
for line in fmt_text.iter() {
210+
write!(out, "{}\n\r", line)?;
211+
}
210212
out.flush()?;
211213
}
212214
Ok(())

0 commit comments

Comments
 (0)