-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
28 changed files
with
1,011 additions
and
704 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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#![feature(test)] | ||
|
||
extern crate test; | ||
|
||
use bastion_executor::blocking; | ||
use bastion_executor::run::run; | ||
use futures::future::join_all; | ||
use lightproc::proc_stack::ProcStack; | ||
use std::thread; | ||
use std::time::Duration; | ||
use test::Bencher; | ||
|
||
// Benchmark for a 10K burst task spawn | ||
#[bench] | ||
fn run_blocking(b: &mut Bencher) { | ||
b.iter(|| { | ||
let handles = (0..10_000) | ||
.map(|_| { | ||
blocking::spawn_blocking( | ||
async { | ||
let duration = Duration::from_millis(1); | ||
thread::sleep(duration); | ||
}, | ||
ProcStack::default(), | ||
) | ||
}) | ||
.collect::<Vec<_>>(); | ||
|
||
run(join_all(handles), ProcStack::default()) | ||
}); | ||
} | ||
|
||
// Benchmark for a single blocking task spawn | ||
#[bench] | ||
fn run_blocking_single(b: &mut Bencher) { | ||
b.iter(|| { | ||
run( | ||
blocking::spawn_blocking( | ||
async { | ||
let duration = Duration::from_millis(1); | ||
thread::sleep(duration); | ||
}, | ||
ProcStack::default(), | ||
), | ||
ProcStack::default(), | ||
) | ||
}); | ||
} |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.