From 85d5984369442ac6e2652cad73559290023cb76c Mon Sep 17 00:00:00 2001 From: HistidineDwarf Date: Wed, 15 Feb 2023 10:30:45 -0800 Subject: [PATCH] Did benchmarking --- .gitignore | 3 ++- note.txt | 12 ++++++++++++ src/.DS_Store | Bin 6148 -> 6148 bytes src/etcher.rs | 5 ++++- src/main.rs | 2 +- src/timer.rs | 4 ++-- src/ui.rs | 2 +- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index b58d83e..3e2402f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /src/out /output.avi /setting_tests -/output.txt \ No newline at end of file +/output.txt +/src/tests/morbius.webm \ No newline at end of file diff --git a/note.txt b/note.txt index f7517fc..8cc3a1e 100644 --- a/note.txt +++ b/note.txt @@ -30,6 +30,18 @@ After-project: Fix weird bug Code clean-up +Benchmark notes: +430 kb/s average, 4x size, optimal resistance +320 kb/s average, 11x-12x size, paranoid resistance +31.9 mb/s average, 1x size, maximum efficiency +(A lot of this time is just creating the file after the frames are made) + +~8.5ms per frame, optimal resistance +~5.8ms per frame, paranoid resistance +~0.16ms per frame, maximum efficiency + +Probably faster on paranoid because it has to read less ? + diff --git a/src/.DS_Store b/src/.DS_Store index 5694a67206553fcc096096fbfa219b329f489b1f..35935be03f927adc25edc965827a215ef1adcd8c 100644 GIT binary patch delta 76 zcmZoMXfc=|#>B)qu~2NHo+2aj#DLw41(+BanJ4ow-semyPR>cn&(C4le3wy}bu&8$ eKL=3lW=5v(%#-;=EIAk%7=Va@VRL}U7G?kjUJ_0K delta 68 zcmZoMXfc=|#>B`mu~2NHo+2aD#DLwC4MbQb^E2Jq%*4#fy0Jl=aWgvyKL=3FW)+c7G?ldEf0hM diff --git a/src/etcher.rs b/src/etcher.rs index a3c8259..5732464 100644 --- a/src/etcher.rs +++ b/src/etcher.rs @@ -171,7 +171,7 @@ fn etch_pixel(frame: &mut EmbedSource, rgb: Vec, x: i32, y: i32) -> anyhow:: fn etch_bw(source: &mut EmbedSource, data: &Vec, global_index: &mut usize) -> anyhow::Result<()> { - // let _timer = Timer::new("Etching frame"); + let _timer = Timer::new("Etching frame"); let width = source.actual_size.width; let height = source.actual_size.height; @@ -208,6 +208,7 @@ fn etch_bw(source: &mut EmbedSource, data: &Vec, global_index: &mut usize) fn etch_color(source: &mut EmbedSource, data: &Vec, global_index: &mut usize) -> anyhow::Result<()>{ + let _timer = Timer::new("Etching frame"); let width = source.actual_size.width; let height = source.actual_size.height; @@ -335,6 +336,7 @@ fn etch_instructions(settings: &Settings, data: &Data) final_frame += 1; } + dbg!(final_frame); u32_instructions.push(final_frame as u32); u32_instructions.push(final_byte as u32); }, @@ -350,6 +352,7 @@ fn etch_instructions(settings: &Settings, data: &Data) final_frame += 1; } + dbg!(final_frame); u32_instructions.push(final_frame as u32); u32_instructions.push(final_byte as u32); }, diff --git a/src/main.rs b/src/main.rs index 3562e92..217be88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ async fn main() -> anyhow::Result<()> { println!("3. Upload the video to your YouTube channel. You probably want to keep it up as unlisted"); println!("4. Use the download option to get the video back"); println!("5. Use the dislodge option to get your files back from the downloaded video"); - println!("6. PROFIT. Enjoy being a leech on a huge corporation's servers"); + println!("6. PROFIT. Enjoy being a leech on a huge corporation's servers\n"); ui::summon_gooey().await?; // let bytes = etcher::rip_bytes("src/tests/Baby.wav")?; diff --git a/src/timer.rs b/src/timer.rs index 6206f8d..dab85c7 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -12,9 +12,9 @@ impl Drop for Timer { let millis = self.time.elapsed().as_millis(); if micros < 10000 { - println!("{} ended in {}us", self.title, self.time.elapsed().as_micros()); + println!("{} ended in {}us", self.title, micros); } else { - println!("{} ended in {}ms", self.title, self.time.elapsed().as_millis()); + println!("{} ended in {}ms", self.title, millis); } } diff --git a/src/ui.rs b/src/ui.rs index 6d6c74b..8ba6d8f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -88,7 +88,7 @@ fn embed_path() -> anyhow::Result<()> { let binary = etcher::rip_binary(bytes)?; let data = Data::from_binary(binary); - let settings = Settings::new(4, 8, 10, 1280, 720); + let settings = Settings::new(4, 8, 30, 1280, 720); etcher::etch("output.avi", data, settings)?;