diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-29 21:51:17 -0500 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-29 21:56:49 -0500 |
commit | 72ff775b234644113487f5af8fc358d07bdc3178 (patch) | |
tree | 52efa0493e95ebac77d6035a1f7aea20839a1033 /src | |
parent | 26ac1df0b19a1c880d346493670cb816a5d8dc06 (diff) | |
download | alacritty-72ff775b234644113487f5af8fc358d07bdc3178.tar.gz alacritty-72ff775b234644113487f5af8fc358d07bdc3178.zip |
Improve RenderableCellsIter performance
Also adds a benchmark for cell.reset().
Diffstat (limited to 'src')
-rw-r--r-- | src/term/cell.rs | 21 | ||||
-rw-r--r-- | src/term/mod.rs | 2 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/term/cell.rs b/src/term/cell.rs index 6bb1ab87..499f99b8 100644 --- a/src/term/cell.rs +++ b/src/term/cell.rs @@ -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); + }); + } +} diff --git a/src/term/mod.rs b/src/term/mod.rs index 4f797871..319f7520 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1065,7 +1065,7 @@ mod tests { } #[cfg(test)] -mod bench { +mod benches { extern crate test; extern crate serde_json as json; |