aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/term/cell.rs21
-rw-r--r--src/term/mod.rs2
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;