Skip to content

Commit

Permalink
Merge c016b9d into a0db788
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed Apr 13, 2020
2 parents a0db788 + c016b9d commit fddf015
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 62 deletions.
75 changes: 55 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions boa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ default = ["wasm-bindgen"]
[dependencies]
gc = "0.3.3"
gc_derive = "0.3.2"
serde_json = "1.0.48"
serde_json = "1.0.51"
rand = "0.7.3"
regex = "1.3.6"

# Optional Dependencies
wasm-bindgen = { version = "0.2.59", optional = true }
serde = { version = "1.0.105", features = ["derive"], optional = true }
wasm-bindgen = { version = "0.2.60", optional = true }
serde = { version = "1.0.106", features = ["derive"], optional = true }

[dev-dependencies]
criterion = "0.3.1"

[target.x86_64-unknown-linux-gnu.dev-dependencies]
jemallocator = "0.3.2"

[lib]
crate-type = ["cdylib", "lib"]
name = "boa"
Expand Down
13 changes: 8 additions & 5 deletions boa/benches/exec.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#[macro_use]
extern crate criterion;
use boa::{exec, realm::Realm};
use criterion::{black_box, criterion_group, criterion_main, Criterion};

use boa::exec;
use boa::realm::Realm;
use criterion::{black_box, Criterion};
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

static SRC: &str = r#"
let a = Symbol();
Expand Down
19 changes: 11 additions & 8 deletions boa/benches/fib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#[macro_use]
extern crate criterion;

use boa::exec;
use criterion::black_box;
use criterion::Criterion;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

static SRC: &str = r#"
let num = 12;
Expand All @@ -19,9 +22,9 @@ res;
"#;

fn fibonacci(c: &mut Criterion) {
c.bench_function("fibonacci (Execution)", move |b| {
b.iter(|| exec(black_box(SRC)))
});
c.bench_function("fibonacci (Execution)", move |b| {
b.iter(|| exec(black_box(SRC)))
});
}

criterion_group!(benches, fibonacci);
Expand Down
14 changes: 8 additions & 6 deletions boa/benches/parser.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#[macro_use]
extern crate criterion;
use boa::syntax::{lexer::Lexer, parser::Parser};
use criterion::{black_box, criterion_group, criterion_main, Criterion};

use boa::syntax::lexer::Lexer;
use boa::syntax::parser::Parser;
use criterion::black_box;
use criterion::Criterion;
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

static EXPRESSION: &str = r#"
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
Expand Down
18 changes: 11 additions & 7 deletions boa/benches/string.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#[macro_use]
extern crate criterion;
use boa::{
exec,
syntax::{lexer::Lexer, parser::Parser},
};
use criterion::{black_box, criterion_group, criterion_main, Criterion};

use boa::exec;
use boa::syntax::lexer::Lexer;
use boa::syntax::parser::Parser;
use criterion::black_box;
use criterion::Criterion;
#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

static SRC: &str = "let foo = 'hello world!'; foo;";

Expand Down
5 changes: 4 additions & 1 deletion boa_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ edition = "2018"

[dependencies]
Boa = { path = "../boa", features = ["serde-ast"], default-features = false }
structopt = "0.3.12"
structopt = "0.3.13"

[target.x86_64-unknown-linux-gnu.dependencies]
jemallocator = "0.3.2"
60 changes: 48 additions & 12 deletions boa_cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
#![deny(unused_qualifications, clippy::correctness, clippy::style)]
#![warn(clippy::perf)]
#![allow(clippy::cognitive_complexity)]

use boa::builtins::console::log;
use boa::serde_json;
use boa::syntax::ast::{node::Node, token::Token};
use boa::{exec::Executor, forward_val, realm::Realm};
use std::io::{self, Write};
use std::{fs::read_to_string, path::PathBuf};
use structopt::clap::arg_enum;
use structopt::StructOpt;
#![deny(
unused_qualifications,
clippy::all,
unused_qualifications,
unused_import_braces,
unused_lifetimes,
unreachable_pub,
trivial_numeric_casts,
rustdoc,
missing_debug_implementations,
missing_copy_implementations,
deprecated_in_future,
non_ascii_idents,
rust_2018_compatibility,
rust_2018_idioms,
future_incompatible,
nonstandard_style
)]
#![warn(clippy::perf, clippy::single_match_else, clippy::dbg_macro)]
#![allow(
clippy::missing_inline_in_public_items,
clippy::cognitive_complexity,
clippy::must_use_candidate,
clippy::missing_errors_doc,
clippy::as_conversions
)]

use boa::{
builtins::console::log,
exec::Executor,
forward_val,
realm::Realm,
serde_json,
syntax::ast::{node::Node, token::Token},
};
use std::{
fs::read_to_string,
io::{self, Write},
path::PathBuf,
};
use structopt::{clap::arg_enum, StructOpt};

#[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
#[cfg_attr(
all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"),
global_allocator
)]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

/// CLI configuration for Boa.
//
Expand Down

0 comments on commit fddf015

Please sign in to comment.