Skip to content

Commit

Permalink
Fixed builds and updated macro import to 2018 edition
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed Apr 16, 2020
1 parent d532783 commit 63b0014
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
14 changes: 6 additions & 8 deletions boa/benches/exec.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#[macro_use]
extern crate criterion;
//! Benchmarks of the whole execution engine in Boa.
use boa::exec;
use boa::realm::Realm;
use criterion::{black_box, Criterion};
use boa::{exec, realm::Realm};
use criterion::{black_box, criterion_group, criterion_main, Criterion};

static SYMBOL_CREATION: &str = r#"
let a = Symbol();
Expand Down Expand Up @@ -65,10 +63,10 @@ fn fibonacci(c: &mut Criterion) {
}

criterion_group!(
benches,
execution,
create_realm,
symbol_creation,
for_loop_execution,
fibonnaci
fibonacci
);
criterion_main!(benches);
criterion_main!(execution);
12 changes: 4 additions & 8 deletions boa/benches/lexer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#[macro_use]
extern crate criterion;
//! Benchmarks of the lexing process in Boa.
use boa::exec;
use boa::syntax::lexer::Lexer;
use boa::syntax::parser::Parser;
use criterion::black_box;
use criterion::Criterion;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

static EXPRESSION: &str = r#"
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
Expand Down Expand Up @@ -56,5 +52,5 @@ fn for_loop_lexer(c: &mut Criterion) {
});
}

criterion_group!(benches, expression_lexer, hello_world_lexer, for_loop_lexer);
criterion_main!(benches);
criterion_group!(lexer, expression_lexer, hello_world_lexer, for_loop_lexer);
criterion_main!(lexer);
15 changes: 7 additions & 8 deletions boa/benches/parser.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#[macro_use]
extern crate criterion;
//! Benchmarks of the parsing process in Boa.
use boa::syntax::lexer::Lexer;
use boa::syntax::parser::Parser;
use criterion::black_box;
use criterion::Criterion;
use boa::syntax::{lexer::Lexer, parser::Parser};
use criterion::{black_box, criterion_group, criterion_main, Criterion};

static EXPRESSION: &str = r#"
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
"#;

fn expression_parser(c: &mut Criterion) {
// We include the lexing in the benchmarks, since they will get together soon, anyways.

c.bench_function("Expression (Parser)", move |b| {
b.iter(|| {
let mut lexer = Lexer::new(black_box(EXPRESSION));
Expand All @@ -26,6 +24,7 @@ static HELLO_WORLD: &str = "let foo = 'hello world!'; foo;";

fn hello_world_parser(c: &mut Criterion) {
// We include the lexing in the benchmarks, since they will get together soon, anyways.

c.bench_function("Hello World (Parser)", move |b| {
b.iter(|| {
let mut lexer = Lexer::new(black_box(HELLO_WORLD));
Expand Down Expand Up @@ -62,9 +61,9 @@ fn for_loop_parser(c: &mut Criterion) {
}

criterion_group!(
benches,
parser,
expression_parser,
hello_world_parser,
for_loop_parser
);
criterion_main!(benches);
criterion_main!(parser);

0 comments on commit 63b0014

Please sign in to comment.