auto merge of #12411 : Arcterus/rust/time, r=alexcrichton
More work towards finishing #8784.
This commit is contained in:
commit
56cf237ee2
23 changed files with 54 additions and 43 deletions
|
|
@ -8,10 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
extern crate time;
|
||||
|
||||
use extra::time;
|
||||
use collections::TreeMap;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::os;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
extern crate time;
|
||||
|
||||
use collections::bitv::BitvSet;
|
||||
use collections::TreeSet;
|
||||
|
|
@ -31,9 +31,9 @@ struct Results {
|
|||
}
|
||||
|
||||
fn timed(result: &mut f64, op: ||) {
|
||||
let start = extra::time::precise_time_s();
|
||||
let start = time::precise_time_s();
|
||||
op();
|
||||
let end = extra::time::precise_time_s();
|
||||
let end = time::precise_time_s();
|
||||
*result = (end - start);
|
||||
}
|
||||
|
||||
|
|
@ -191,13 +191,13 @@ fn main() {
|
|||
let s: TreeSet<~str> = TreeSet::new();
|
||||
s
|
||||
});
|
||||
write_results("extra::treemap::TreeSet", &results);
|
||||
write_results("collections::TreeSet", &results);
|
||||
}
|
||||
|
||||
{
|
||||
let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed);
|
||||
let mut results = empty_results();
|
||||
results.bench_int(&mut rng, num_keys, max, || BitvSet::new());
|
||||
write_results("extra::bitv::BitvSet", &results);
|
||||
write_results("collections::bitv::BitvSet", &results);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
#[feature(macro_rules)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate time;
|
||||
|
||||
use extra::time::precise_time_s;
|
||||
use time::precise_time_s;
|
||||
use std::mem::swap;
|
||||
use std::os;
|
||||
use std::rand::Rng;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
// different scalability characteristics compared to the select
|
||||
// version.
|
||||
|
||||
extern crate extra;
|
||||
extern crate time;
|
||||
|
||||
use std::comm;
|
||||
use std::os;
|
||||
|
|
@ -58,7 +58,7 @@ fn run(args: &[~str]) {
|
|||
let size = from_str::<uint>(args[1]).unwrap();
|
||||
let workers = from_str::<uint>(args[2]).unwrap();
|
||||
let num_bytes = 100;
|
||||
let start = extra::time::precise_time_s();
|
||||
let start = time::precise_time_s();
|
||||
let mut worker_results = ~[];
|
||||
for _ in range(0u, workers) {
|
||||
let to_child = to_child.clone();
|
||||
|
|
@ -84,7 +84,7 @@ fn run(args: &[~str]) {
|
|||
to_child.send(stop);
|
||||
move_out(to_child);
|
||||
let result = from_child.recv();
|
||||
let end = extra::time::precise_time_s();
|
||||
let end = time::precise_time_s();
|
||||
let elapsed = end - start;
|
||||
print!("Count is {:?}\n", result);
|
||||
print!("Test took {:?} seconds\n", elapsed);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// I *think* it's the same, more or less.
|
||||
|
||||
extern crate extra;
|
||||
extern crate time;
|
||||
|
||||
use std::os;
|
||||
use std::task;
|
||||
|
|
@ -52,7 +52,7 @@ fn run(args: &[~str]) {
|
|||
let size = from_str::<uint>(args[1]).unwrap();
|
||||
let workers = from_str::<uint>(args[2]).unwrap();
|
||||
let num_bytes = 100;
|
||||
let start = extra::time::precise_time_s();
|
||||
let start = time::precise_time_s();
|
||||
let mut worker_results = ~[];
|
||||
let from_parent = if workers == 1 {
|
||||
let (from_parent, to_child) = Chan::new();
|
||||
|
|
@ -94,7 +94,7 @@ fn run(args: &[~str]) {
|
|||
//to_child.send(stop);
|
||||
//move_out(to_child);
|
||||
let result = from_child.recv();
|
||||
let end = extra::time::precise_time_s();
|
||||
let end = time::precise_time_s();
|
||||
let elapsed = end - start;
|
||||
print!("Count is {:?}\n", result);
|
||||
print!("Test took {:?} seconds\n", elapsed);
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@
|
|||
|
||||
// This also serves as a pipes test, because Arcs are implemented with pipes.
|
||||
|
||||
extern crate extra;
|
||||
extern crate sync;
|
||||
extern crate time;
|
||||
|
||||
use sync::Arc;
|
||||
use sync::MutexArc;
|
||||
use sync::Future;
|
||||
use extra::time;
|
||||
use std::os;
|
||||
use std::uint;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@
|
|||
|
||||
// This also serves as a pipes test, because Arcs are implemented with pipes.
|
||||
|
||||
extern crate extra;
|
||||
extern crate sync;
|
||||
extern crate time;
|
||||
|
||||
use sync::RWArc;
|
||||
use sync::Future;
|
||||
use extra::time;
|
||||
use std::os;
|
||||
use std::uint;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,9 @@
|
|||
|
||||
*/
|
||||
|
||||
extern crate extra;
|
||||
extern crate getopts;
|
||||
extern crate time;
|
||||
|
||||
use extra::time;
|
||||
use std::os;
|
||||
use std::result::{Ok, Err};
|
||||
use std::task;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// Microbenchmark for the smallintmap library
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
extern crate time;
|
||||
|
||||
use collections::SmallIntMap;
|
||||
use std::os;
|
||||
|
|
@ -46,11 +46,11 @@ fn main() {
|
|||
|
||||
for _ in range(0u, rep) {
|
||||
let mut map = SmallIntMap::new();
|
||||
let start = extra::time::precise_time_s();
|
||||
let start = time::precise_time_s();
|
||||
append_sequential(0u, max, &mut map);
|
||||
let mid = extra::time::precise_time_s();
|
||||
let mid = time::precise_time_s();
|
||||
check_sequential(0u, max, &map);
|
||||
let end = extra::time::precise_time_s();
|
||||
let end = time::precise_time_s();
|
||||
|
||||
checkf += (end - mid) as f64;
|
||||
appendf += (mid - start) as f64;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
extern crate time;
|
||||
|
||||
use collections::list::{List, Cons, Nil};
|
||||
use extra::time::precise_time_s;
|
||||
use time::precise_time_s;
|
||||
use std::os;
|
||||
use std::task;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#[feature(managed_boxes)];
|
||||
|
||||
extern crate extra;
|
||||
extern crate time;
|
||||
|
||||
// These tests used to be separate files, but I wanted to refactor all
|
||||
// the common code.
|
||||
|
|
@ -26,7 +27,6 @@ use std::cmp::Eq;
|
|||
use std::cmp;
|
||||
use std::io;
|
||||
use serialize::{Decodable, Encodable};
|
||||
use extra::time;
|
||||
|
||||
fn test_ebml<'a, A:
|
||||
Eq +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue