Rust编写的JavaScript引擎,该项目是一个试验性质的项目。
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#[macro_use]
|
|
|
|
extern crate criterion;
|
|
|
|
|
|
|
|
use boa::exec;
|
|
|
|
use boa::realm::Realm;
|
|
|
|
use criterion::{black_box, Criterion};
|
|
|
|
|
|
|
|
static SRC: &str = r#"
|
|
|
|
let a = Symbol();
|
|
|
|
let b = Symbol();
|
|
|
|
let c = Symbol();
|
|
|
|
"#;
|
|
|
|
|
|
|
|
fn symbol_creation(c: &mut Criterion) {
|
|
|
|
c.bench_function("Symbol Creation", move |b| b.iter(|| exec(black_box(SRC))));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn create_realm(c: &mut Criterion) {
|
|
|
|
c.bench_function("Create Realm", move |b| b.iter(|| Realm::create()));
|
|
|
|
}
|
|
|
|
|
|
|
|
criterion_group!(benches, create_realm, symbol_creation);
|
|
|
|
criterion_main!(benches);
|