1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

micro optimize clearing a line

Turns out to be faster to clear and then resize than it is to
resize down and manually assign the elements
This commit is contained in:
Wez Furlong 2019-02-22 21:52:18 -08:00
parent a022d3856a
commit 819bc247a0

View File

@ -56,10 +56,8 @@ impl Line {
pub fn resize_and_clear(&mut self, width: usize) {
let blank = Cell::default();
self.cells.clear();
self.cells.resize(width, blank);
for cell in &mut self.cells {
*cell = Cell::default();
}
self.bits = LineBits::DIRTY;
}