aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-09 11:33:55 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-09 14:58:57 -0500
commitff829993431c3a710169271c7ec691bc62030bc3 (patch)
tree820433cf2427cddd95170eba8137915f81185b6d /examples
parent61380c18cb66cb4e6be20fdd6fa56816cc05cc59 (diff)
downloadvt100-rust-ff829993431c3a710169271c7ec691bc62030bc3.tar.gz
vt100-rust-ff829993431c3a710169271c7ec691bc62030bc3.zip
improve benchmarks a bit more
Diffstat (limited to 'examples')
-rw-r--r--examples/process.rs9
-rw-r--r--examples/process_diff.rs9
-rw-r--r--examples/process_full.rs9
3 files changed, 24 insertions, 3 deletions
diff --git a/examples/process.rs b/examples/process.rs
index 98236f7..ea36db1 100644
--- a/examples/process.rs
+++ b/examples/process.rs
@@ -20,7 +20,14 @@ fn process_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..100 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
process_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}
diff --git a/examples/process_diff.rs b/examples/process_diff.rs
index 4222c6e..6132971 100644
--- a/examples/process_diff.rs
+++ b/examples/process_diff.rs
@@ -26,7 +26,14 @@ fn draw_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..10 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
draw_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}
diff --git a/examples/process_full.rs b/examples/process_full.rs
index c62bcb2..a49af29 100644
--- a/examples/process_full.rs
+++ b/examples/process_full.rs
@@ -23,7 +23,14 @@ fn draw_frames(frames: &[Vec<u8>]) {
fn main() {
let frames: Vec<Vec<u8>> = read_frames().collect();
- for _ in 1..10 {
+ let start = std::time::Instant::now();
+ let mut i = 0;
+ loop {
+ i += 1;
draw_frames(&frames);
+ if (std::time::Instant::now() - start).as_secs() >= 30 {
+ break;
+ }
}
+ eprintln!("{} iterations", i);
}