Skip to content
This repository
Newer
Older
100644 74 lines (66 sloc) 1.969 kb
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
1 // A port of the simplistic benchmark from
2 //
3 // http://github.com/PaulKeeble/ScalaVErlangAgents
4 //
5 // I *think* it's the same, more or less.
6
ea01ee2e »
2012-09-11 Convert 'use' to 'extern mod'. Remove old 'use' syntax
7 extern mod std;
f686896f »
2012-09-05 test: "import" -> "use"
8 use io::Writer;
9 use io::WriterUtil;
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
10
11 enum request {
12 get_count,
13 bytes(uint),
14 stop
15 }
16
9c6890f4 »
2012-08-15 Convert more core types to camel case
17 fn server(requests: comm::Port<request>, responses: comm::Chan<uint>) {
dc07280b »
2012-03-22 make --enforce-mut-vars always on, add mut annotations to remaining f…
18 let mut count = 0u;
19 let mut done = false;
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
20 while !done {
ecaf9e39 »
2012-08-06 Convert alt to match. Stop parsing alt
21 match comm::recv(requests) {
025d8662 »
2012-08-03 Switch alts to use arrows
22 get_count => { comm::send(responses, copy count); }
23 bytes(b) => { count += b; }
24 stop => { done = true; }
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
25 }
26 }
27 comm::send(responses, count);
28 }
29
92743dc2 »
2012-07-13 Move the world over to using the new style string literals and types.…
30 fn run(args: ~[~str]) {
a76e4334 »
2012-08-08 Add spawn_conversation
31 let (from_child, to_child) = do task::spawn_conversation |po, ch| {
32 server(po, ch);
4220dcf1 »
2012-02-18 core: New task API
33 };
4a78f9b1 »
2012-09-21 core: Demode option
34 let size = uint::from_str(args[1]).get();
35 let workers = uint::from_str(args[2]).get();
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
36 let start = std::time::precise_time_s();
98e161f0 »
2012-06-29 Switch the compiler over to using ~[] notation instead of []/~. Closes
37 let mut worker_results = ~[];
d1fc2b59 »
2012-06-30 Convert to new closure syntax
38 for uint::range(0u, workers) |_i| {
18ac4a8e »
2012-08-07 Change task().future_result's argument mode
39 do task::task().future_result(|+r| {
67a8e712 »
2012-09-26 Demode vec::push (and convert to method)
40 worker_results.push(r);
b30a58ab »
2012-07-23 Convert bench and run-pass tests to new task_builder interface
41 }).spawn {
d1fc2b59 »
2012-06-30 Convert to new closure syntax
42 for uint::range(0u, size / workers) |_i| {
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
43 comm::send(to_child, bytes(100u));
44 }
4220dcf1 »
2012-02-18 core: New task API
45 };
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
46 }
9cf271fe »
2012-09-18 De-mode vec::each() and many of the str iteration routines
47 for vec::each(worker_results) |r| {
48 future::get(r);
49 }
4220dcf1 »
2012-02-18 core: New task API
50 comm::send(to_child, stop);
51 let result = comm::recv(from_child);
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
52 let end = std::time::precise_time_s();
53 let elapsed = end - start;
29f32b4a »
2012-08-22 `m1!{...}` -> `m1!(...)`
54 io::stdout().write_str(fmt!("Count is %?\n", result));
55 io::stdout().write_str(fmt!("Test took %? seconds\n", elapsed));
50fb4c30 »
2012-02-09 Increase precedence of as operator
56 let thruput = ((size / workers * workers) as float) / (elapsed as float);
29f32b4a »
2012-08-22 `m1!{...}` -> `m1!(...)`
57 io::stdout().write_str(fmt!("Throughput=%f per sec\n", thruput));
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
58 }
59
edc317b8 »
2012-10-03 Remove arg vectors from main functions. Stop supporting them.
60 fn main() {
61 let args = os::args();
92743dc2 »
2012-07-13 Move the world over to using the new style string literals and types.…
62 let args = if os::getenv(~"RUST_BENCH").is_some() {
63 ~[~"", ~"1000000", ~"10000"]
4fec4cd8 »
2012-05-23 bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
64 } else if args.len() <= 1u {
92743dc2 »
2012-07-13 Move the world over to using the new style string literals and types.…
65 ~[~"", ~"10000", ~"4"]
4fec4cd8 »
2012-05-23 bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
66 } else {
67 args
a76e4334 »
2012-08-08 Add spawn_conversation
68 };
4fec4cd8 »
2012-05-23 bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
69
29f32b4a »
2012-08-22 `m1!{...}` -> `m1!(...)`
70 debug!("%?", args);
4fec4cd8 »
2012-05-23 bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
71 run(args);
5660b8bf »
2012-01-23 add msgsend.rs to benchmarks
72 }
73
Something went wrong with that request. Please try again.