mirror of
https://github.com/alacritty/alacritty.git
synced 2025-02-10 15:46:10 -05:00
Improve RenderableCellsIter performance
Also adds a benchmark for cell.reset().
This commit is contained in:
parent
26ac1df0b1
commit
72ff775b23
2 changed files with 21 additions and 2 deletions
|
@ -28,7 +28,7 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
|
||||||
pub struct Cell {
|
pub struct Cell {
|
||||||
pub c: char,
|
pub c: char,
|
||||||
pub fg: Color,
|
pub fg: Color,
|
||||||
|
@ -130,3 +130,22 @@ mod tests {
|
||||||
assert_eq!(row.line_length(), Column(10));
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod bench {
|
mod benches {
|
||||||
extern crate test;
|
extern crate test;
|
||||||
extern crate serde_json as json;
|
extern crate serde_json as json;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue