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 committed 2019-02-22 21:52:18 -08:00
1 parent a022d3856a
commit 819bc247a0
1 file changed
+1 -3
+1 -3
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;
}