Did benchmarking

This commit is contained in:
HistidineDwarf 2023-02-15 10:30:45 -08:00
parent eb07109be8
commit 85d5984369
7 changed files with 22 additions and 6 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@
/src/out
/output.avi
/setting_tests
/output.txt
/output.txt
/src/tests/morbius.webm

View File

@ -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 ?

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -171,7 +171,7 @@ fn etch_pixel(frame: &mut EmbedSource, rgb: Vec<u8>, x: i32, y: i32) -> anyhow::
fn etch_bw(source: &mut EmbedSource, data: &Vec<bool>, 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<bool>, global_index: &mut usize)
fn etch_color(source: &mut EmbedSource, data: &Vec<u8>, 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);
},

View File

@ -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")?;

View File

@ -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);
}
}

View File

@ -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)?;