mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-16 14:25:03 +01:00
things
This commit is contained in:
parent
5634330287
commit
cec7204c6d
5 changed files with 742 additions and 12 deletions
|
|
@ -21,7 +21,7 @@ impl Write for MockReadWrite {
|
|||
}
|
||||
}
|
||||
|
||||
fn run_bf_bench(bf: &str) {
|
||||
fn run_bf(bf: &str) {
|
||||
let bump = Bump::new();
|
||||
let parsed = brainfuck::parse::parse(&bump, bf.bytes().enumerate()).unwrap();
|
||||
let optimized = brainfuck::opts::optimize(&bump, &parsed);
|
||||
|
|
@ -30,18 +30,16 @@ fn run_bf_bench(bf: &str) {
|
|||
|
||||
fn optimized(c: &mut Criterion) {
|
||||
let fizzbuzz = include_str!("fizzbuzz.bf");
|
||||
let hello_world = include_str!("hello.bf");
|
||||
let bench = include_str!("bench.bf");
|
||||
let loopremove = include_str!("loopremove.bf");
|
||||
let twinkle = include_str!("twinkle.bf");
|
||||
let bottles = include_str!("bottles.bf");
|
||||
|
||||
c.bench_function("fizzbuzz", |b| b.iter(|| run_bf_bench(black_box(fizzbuzz))));
|
||||
c.bench_function("hello_world", |b| {
|
||||
b.iter(|| run_bf_bench(black_box(hello_world)))
|
||||
});
|
||||
c.bench_function("bench", |b| b.iter(|| run_bf_bench(black_box(bench))));
|
||||
c.bench_function("loopremove", |b| {
|
||||
b.iter(|| run_bf_bench(black_box(loopremove)))
|
||||
});
|
||||
c.bench_function("fizzbuzz", |b| b.iter(|| run_bf(black_box(fizzbuzz))));
|
||||
c.bench_function("bench", |b| b.iter(|| run_bf(black_box(bench))));
|
||||
c.bench_function("loopremove", |b| b.iter(|| run_bf(black_box(loopremove))));
|
||||
c.bench_function("twinkle", |b| b.iter(|| run_bf(black_box(twinkle))));
|
||||
c.bench_function("bottles", |b| b.iter(|| run_bf(black_box(bottles))));
|
||||
}
|
||||
|
||||
criterion_group!(benches, optimized);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue