Benches: Switch to using real-world assets

This commit is contained in:
Serial 2023-10-23 00:34:18 -04:00 committed by Alex
parent 776c7dadcb
commit af3b98d441
15 changed files with 59 additions and 15 deletions

39
benches/README.md Normal file
View file

@ -0,0 +1,39 @@
# Benchmarks
There are two categories of benchmarks here:
* File parsing for each of the supported file formats
* Tag creation for each of the supported tag formats
## File parsing
The file parsing benchmarks are run on a set of assets that attempt to be representative of
files one would find in the wild.
The song used is "TempleOS Hymn Risen (Remix)" by Dave Eddy, licensed under Public Domain.
Links to the song:
* [YouTube](https://www.youtube.com/watch?v=IdYMA6hY_74)
* [Bandcamp](https://daveeddy.bandcamp.com/track/templeos-hymn-risen-remix)
* [Creator's site](https://music.daveeddy.com/tracks/templeos-hymn-risen-remix/)
The file was originally provided as a FLAC, and has been re-encoded to the other formats.
Some conditions:
* Each file will only make use of their ["primary tag"](https://docs.rs/lofty/latest/lofty/enum.FileType.html#method.primary_tag_type).
* The following fields are used (with some possibly left out, depending on the format):
* Title
* Artist
* Album
* Date
* Track number
* Genre
* Picture (Front cover)
* Encoder
### Tag creation
The tag creation benchmarks will only create the tags and dump them to a writer,
this will not take into account the time it takes to write the tags to a file.
The tags will be created using the same conditions as above, with the exact same data as present in the files.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -20,9 +20,14 @@ macro_rules! bench_tag_write {
let mut v = Vec::new(); let mut v = Vec::new();
let mut tag = <$tag>::default(); let mut tag = <$tag>::default();
tag.set_artist(String::from("Foo artist")); tag.set_artist(String::from("Dave Eddy"));
tag.set_title(String::from("Bar title")); tag.set_title(String::from("TempleOS Hymn Risen (Remix)"));
tag.set_album(String::from("Baz album")); tag.set_album(String::from("Summer"));
tag.set_year(2017);
tag.set_track_number(1);
tag.set_genre(String::from("Electronic"));
// TODO: Front cover
// TODO: Encoder
tag.dump_to(&mut v).unwrap(); tag.dump_to(&mut v).unwrap();
}) })
); );

View file

@ -30,18 +30,18 @@ fn content_infer_read(c: &mut Criterion) {
test_read_file!( test_read_file!(
c, c,
[ [
(AAC, "../tests/files/assets/minimal/full_test.aac"), (AAC, "assets/01 TempleOS Hymn Risen (Remix).aac"),
(AIFF, "../tests/files/assets/minimal/full_test.aiff"), (AIFF, "assets/01 TempleOS Hymn Risen (Remix).aiff"),
(APE, "../tests/files/assets/minimal/full_test.ape"), (APE, "assets/01 TempleOS Hymn Risen (Remix).ape"),
(FLAC, "../tests/files/assets/minimal/full_test.flac"), (FLAC, "assets/01 TempleOS Hymn Risen (Remix).flac"),
(MP4, "../tests/files/assets/minimal/m4a_codec_aac.m4a"), (MP4, "assets/01 TempleOS Hymn Risen (Remix).m4a"),
(MP3, "../tests/files/assets/minimal/full_test.mp3"), (MP3, "assets/01 TempleOS Hymn Risen (Remix).mp3"),
(MPC, "../tests/files/assets/minimal/mpc_sv8.mpc"), (MPC, "assets/01 TempleOS Hymn Risen (Remix).mpc"),
(OPUS, "../tests/files/assets/minimal/full_test.opus"), (OPUS, "assets/01 TempleOS Hymn Risen (Remix).opus"),
(RIFF, "../tests/files/assets/minimal/wav_format_pcm.wav"), (RIFF, "assets/01 TempleOS Hymn Risen (Remix).wav"),
(SPEEX, "../tests/files/assets/minimal/full_test.spx"), (SPEEX, "assets/01 TempleOS Hymn Risen (Remix).spx"),
(VORBIS, "../tests/files/assets/minimal/full_test.ogg"), (VORBIS, "assets/01 TempleOS Hymn Risen (Remix).ogg"),
(WAVPACK, "../tests/files/assets/minimal/full_test.wv"), (WAVPACK, "assets/01 TempleOS Hymn Risen (Remix).wv"),
] ]
); );
} }