This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from nightly bench to
bencher
crate
- Loading branch information
Showing
3 changed files
with
52 additions
and
59 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
#![feature(test)] | ||
mod from_u8 { | ||
extern crate test; | ||
use self::test::Bencher; | ||
extern crate tree_magic; | ||
#[macro_use] | ||
extern crate bencher; | ||
extern crate tree_magic; | ||
use bencher::Bencher; | ||
|
||
///Image tests | ||
#[bench] | ||
fn image_gif(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("image/gif"))); | ||
} | ||
#[bench] | ||
fn image_png(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("image/png"))); | ||
} | ||
|
||
/// Archive tests | ||
#[bench] | ||
fn application_zip(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("application/zip"))); | ||
} | ||
///Image tests | ||
fn image_gif(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("image/gif"))); | ||
} | ||
fn image_png(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("image/png"))); | ||
} | ||
|
||
/// Text tests | ||
#[bench] | ||
fn text_plain(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("text/plain"))); | ||
} | ||
/// Archive tests | ||
fn application_zip(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("application/zip"))); | ||
} | ||
|
||
/// Text tests | ||
fn text_plain(b: &mut Bencher) { | ||
b.iter(|| tree_magic::from_u8(include_bytes!("text/plain"))); | ||
} | ||
|
||
benchmark_group!(benches, image_gif, image_png, application_zip, text_plain); | ||
benchmark_main!(benches); |
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 |
---|---|---|
@@ -1,38 +1,25 @@ | ||
#![feature(test)] | ||
mod match_u8 { | ||
extern crate test; | ||
use self::test::Bencher; | ||
extern crate tree_magic; | ||
#[macro_use] | ||
extern crate bencher; | ||
extern crate tree_magic; | ||
use bencher::Bencher; | ||
|
||
#[cfg(not(feature="staticmime"))] | ||
macro_rules! convmime { | ||
($x:expr) => {$x.to_string()} | ||
} | ||
#[cfg(feature="staticmime")] | ||
macro_rules! convmime { | ||
($x:expr) => {$x} | ||
} | ||
|
||
///Image benchmarks | ||
#[bench] | ||
fn image_gif(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("image/gif", include_bytes!("image/gif"))); | ||
} | ||
#[bench] | ||
fn image_png(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("image/png", include_bytes!("image/png"))); | ||
} | ||
|
||
/// Archive tests | ||
#[bench] | ||
fn application_zip(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("application/zip", include_bytes!("application/zip"))); | ||
} | ||
///Image benchmarks | ||
fn image_gif(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("image/gif", include_bytes!("image/gif"))); | ||
} | ||
fn image_png(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("image/png", include_bytes!("image/png"))); | ||
} | ||
|
||
/// Text tests | ||
#[bench] | ||
fn text_plain(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("text/plain", include_bytes!("text/plain"))); | ||
} | ||
/// Archive tests | ||
fn application_zip(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("application/zip", include_bytes!("application/zip"))); | ||
} | ||
|
||
/// Text tests | ||
fn text_plain(b: &mut Bencher) { | ||
b.iter(|| tree_magic::match_u8("text/plain", include_bytes!("text/plain"))); | ||
} | ||
|
||
benchmark_group!(benches, image_gif, image_png, application_zip, text_plain); | ||
benchmark_main!(benches); |