-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git squash commit for iai-benchmarks.
54671350698ec53bb67cb827bf86f96fcc2ba49f . 7cfc1838cc3316f0b0ce0e567adf9df83d7cea59 .
- Loading branch information
1 parent
f5021fb
commit 16c5d82
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use iai::black_box; | ||
|
||
fn decode(data: &[u8]) -> Vec<u8> { | ||
let data = black_box(data); | ||
let decoder = png::Decoder::new(data); | ||
let mut reader = decoder.read_info().unwrap(); | ||
let mut image = vec![0; reader.output_buffer_size()]; | ||
reader.next_frame(&mut image).unwrap(); | ||
image | ||
} | ||
|
||
fn iai_decode_kodim02() -> Vec<u8> { | ||
decode(include_bytes!("../tests/benches/kodim02.png")) | ||
} | ||
|
||
fn iai_decode_kodim07() -> Vec<u8> { | ||
decode(include_bytes!("../tests/benches/kodim07.png")) | ||
} | ||
|
||
fn iai_decode_kodim17() -> Vec<u8> { | ||
decode(include_bytes!("../tests/benches/kodim17.png")) | ||
} | ||
|
||
fn iai_decode_kodim23() -> Vec<u8> { | ||
decode(include_bytes!("../tests/benches/kodim23.png")) | ||
} | ||
|
||
iai::main!{ | ||
iai_decode_kodim02, | ||
iai_decode_kodim07, | ||
iai_decode_kodim17, | ||
iai_decode_kodim23, | ||
} |