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:
1 parent
a022d3856a
commit
819bc247a0
1 file changed
+1
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user