1
Fork 0

Reorganize benches.

This commit is contained in:
Scott Olson 2016-06-17 22:35:34 -06:00
parent f4cf3f3636
commit c6ec4f4397
7 changed files with 14 additions and 21 deletions

View file

@ -1,11 +1,9 @@
#![feature(custom_attribute, test)] #![feature(test, rustc_private)]
#![feature(rustc_private)]
#![allow(unused_attributes)]
extern crate test; extern crate test;
use test::Bencher; use test::Bencher;
mod helpers;
mod fibonacci_helper; use helpers::*;
#[bench] #[bench]
fn fib(bencher: &mut Bencher) { fn fib(bencher: &mut Bencher) {
@ -14,15 +12,11 @@ fn fib(bencher: &mut Bencher) {
}) })
} }
mod miri_helper;
#[bench] #[bench]
fn fib_miri(bencher: &mut Bencher) { fn fib_miri(bencher: &mut Bencher) {
miri_helper::run("fibonacci_helper", bencher); miri_helper::run("fibonacci_helper", bencher);
} }
mod fibonacci_helper_iterative;
#[bench] #[bench]
fn fib_iter(bencher: &mut Bencher) { fn fib_iter(bencher: &mut Bencher) {
bencher.iter(|| { bencher.iter(|| {

View file

@ -1,7 +1,3 @@
#![feature(custom_attribute, test)]
#![feature(rustc_private)]
#![allow(unused_attributes)]
extern crate getopts; extern crate getopts;
extern crate miri; extern crate miri;
extern crate rustc; extern crate rustc;
@ -32,7 +28,7 @@ fn find_sysroot() -> String {
pub fn run(filename: &str, bencher: &mut Bencher) { pub fn run(filename: &str, bencher: &mut Bencher) {
let args = &[ let args = &[
"miri".to_string(), "miri".to_string(),
format!("benches/{}.rs", filename), format!("benches/helpers/{}.rs", filename),
"--sysroot".to_string(), "--sysroot".to_string(),
find_sysroot() find_sysroot()
]; ];

7
benches/helpers/mod.rs Normal file
View file

@ -0,0 +1,7 @@
// This module gets included in multiple crates, and they each only use part of it.
#![allow(dead_code)]
pub mod fibonacci_helper;
pub mod fibonacci_helper_iterative;
pub mod miri_helper;
pub mod smoke_helper;

View file

@ -1,11 +1,9 @@
#![feature(custom_attribute, test)] #![feature(test, rustc_private)]
#![feature(rustc_private)]
#![allow(unused_attributes)]
extern crate test; extern crate test;
use test::Bencher; use test::Bencher;
mod helpers;
mod smoke_helper; use helpers::*;
#[bench] #[bench]
fn noop(bencher: &mut Bencher) { fn noop(bencher: &mut Bencher) {
@ -33,8 +31,6 @@ fn noop_miri_full(bencher: &mut Bencher) {
} }
*/ */
mod miri_helper;
#[bench] #[bench]
fn noop_miri_interpreter(bencher: &mut Bencher) { fn noop_miri_interpreter(bencher: &mut Bencher) {
miri_helper::run("smoke_helper", bencher); miri_helper::run("smoke_helper", bencher);