ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since fd54fef was
c1dfa4e,
checked in by Peter A. Buhr <pabuhr@…>, 4 years ago
|
add rust/tokio and rust/async-std benchmarks
|
-
Property mode set to
100644
|
File size:
656 bytes
|
Rev | Line | |
---|
[c1dfa4e] | 1 | use std::env; |
---|
| 2 | use std::process; |
---|
| 3 | use std::time::Instant; |
---|
| 4 | |
---|
| 5 | async fn nop() {} |
---|
| 6 | |
---|
| 7 | #[async_std::main] |
---|
| 8 | async fn main() { |
---|
| 9 | let mut times : u32 = 50000000; |
---|
| 10 | let args: Vec<String> = env::args().collect(); |
---|
| 11 | if args.len() > 2 { process::exit( 1 ); } |
---|
| 12 | if args.len() == 2 { times = args[1].parse().unwrap(); } |
---|
| 13 | |
---|
| 14 | let start = Instant::now(); |
---|
| 15 | for _ in 1..times { |
---|
| 16 | nop().await; |
---|
| 17 | } |
---|
| 18 | let duration = start.elapsed() / times; |
---|
| 19 | println!( "{:?}", duration.as_nanos() ) |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | // ~/software/rust/async-std/src/main.rs |
---|
| 23 | // ~/software/rust/async-std/target/release/async-std |
---|
| 24 | // $ cargo build --release |
---|
| 25 | // % async-std |
---|
| 26 | |
---|
| 27 | // Local Variables: // |
---|
| 28 | // mode: c++ // |
---|
| 29 | // tab-width: 4 // |
---|
| 30 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.