1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Improve RenderableCellsIter performance

Also adds a benchmark for cell.reset().
This commit is contained in:
Joe Wilm 2016-12-29 21:51:17 -05:00
parent 26ac1df0b1
commit 72ff775b23
2 changed files with 21 additions and 2 deletions

View file

@ -28,7 +28,7 @@ bitflags! {
}
}
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct Cell {
pub c: char,
pub fg: Color,
@ -130,3 +130,22 @@ mod tests {
assert_eq!(row.line_length(), Column(10));
}
}
#[cfg(test)]
mod benches {
extern crate test;
use super::Cell;
#[bench]
fn cell_reset(b: &mut test::Bencher) {
b.iter(|| {
let mut cell = Cell::default();
for _ in 0..100 {
cell.reset(test::black_box(&Cell::default()));
}
test::black_box(cell);
});
}
}

View file

@ -1065,7 +1065,7 @@ mod tests {
}
#[cfg(test)]
mod bench {
mod benches {
extern crate test;
extern crate serde_json as json;