mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-21 18:57:47 +03:00
cargo clippy
This commit is contained in:
parent
a37aa7bae4
commit
bac106b961
@ -20,64 +20,64 @@ use leo_grammar::Grammar;
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use std::{path::Path, time::Duration};
|
||||
|
||||
fn ast<'ast>(ast: &Grammar<'ast>) -> Ast {
|
||||
fn ast(ast: &Grammar) -> Ast {
|
||||
Ast::new("leo_tree", &ast)
|
||||
}
|
||||
|
||||
fn bench_big_if_else(c: &mut Criterion) {
|
||||
let filepath = Path::new("./big_if_else.leo").to_path_buf();
|
||||
let program_string = include_str!("./big_if_else.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::big_if_else", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::big_if_else", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_big_ternary(c: &mut Criterion) {
|
||||
let filepath = Path::new("./big_ternary.leo").to_path_buf();
|
||||
let program_string = include_str!("./big_ternary.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::big_ternary", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::big_ternary", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_big_circuit(c: &mut Criterion) {
|
||||
let filepath = Path::new("./big_circuit.leo").to_path_buf();
|
||||
let program_string = include_str!("./big_circuit.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::big_circuit", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::big_circuit", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_long_expr(c: &mut Criterion) {
|
||||
let filepath = Path::new("./long_expr.leo").to_path_buf();
|
||||
let program_string = include_str!("./long_expr.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::long_expr", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::long_expr", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_long_array(c: &mut Criterion) {
|
||||
let filepath = Path::new("./long_array.leo").to_path_buf();
|
||||
let program_string = include_str!("./long_array.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::long_array", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::long_array", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_many_foos(c: &mut Criterion) {
|
||||
let filepath = Path::new("./many_foos.leo").to_path_buf();
|
||||
let program_string = include_str!("./many_foos.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::many_foos", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::many_foos", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
fn bench_many_assigns(c: &mut Criterion) {
|
||||
let filepath = Path::new("./many_assigns.leo").to_path_buf();
|
||||
let program_string = include_str!("./many_assigns.leo");
|
||||
let ast = Grammar::new(&filepath, program_string).unwrap();
|
||||
let grammar = Grammar::new(&filepath, program_string).unwrap();
|
||||
|
||||
c.bench_function("Ast::many_assigns", |b| b.iter(|| ast(&ast)));
|
||||
c.bench_function("Ast::many_assigns", |b| b.iter(|| ast(&grammar)));
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
|
Loading…
Reference in New Issue
Block a user