@ -21,7 +21,9 @@ fn symbol_creation(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( SYMBOL_CREATION . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( SYMBOL_CREATION . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "Symbols (Execution)" , move | b | {
@ -36,7 +38,7 @@ fn for_loop_execution(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( FOR_LOOP . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( FOR_LOOP . as_bytes ( ) , false ) . parse_all ( ) . unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "For loop (Execution)" , move | b | {
@ -51,7 +53,9 @@ fn fibonacci(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( FIBONACCI . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( FIBONACCI . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "Fibonacci (Execution)" , move | b | {
@ -66,7 +70,9 @@ fn object_creation(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( OBJECT_CREATION . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( OBJECT_CREATION . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "Object Creation (Execution)" , move | b | {
@ -81,7 +87,7 @@ fn object_prop_access_const(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( OBJECT_PROP_ACCESS_CONST . as_bytes ( ) )
let nodes = Parser ::new ( OBJECT_PROP_ACCESS_CONST . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -98,7 +104,7 @@ fn object_prop_access_dyn(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( OBJECT_PROP_ACCESS_DYN . as_bytes ( ) )
let nodes = Parser ::new ( OBJECT_PROP_ACCESS_DYN . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -115,7 +121,7 @@ fn regexp_literal_creation(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( REGEXP_LITERAL_CREATION . as_bytes ( ) )
let nodes = Parser ::new ( REGEXP_LITERAL_CREATION . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -132,7 +138,9 @@ fn regexp_creation(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( REGEXP_CREATION . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( REGEXP_CREATION . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "RegExp (Execution)" , move | b | {
@ -147,7 +155,9 @@ fn regexp_literal(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( REGEXP_LITERAL . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( REGEXP_LITERAL . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "RegExp Literal (Execution)" , move | b | {
@ -162,7 +172,7 @@ fn regexp(c: &mut Criterion) {
let mut engine = Context ::new ( ) ;
// Parse the AST nodes.
let nodes = Parser ::new ( REGEXP . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( REGEXP . as_bytes ( ) , false ) . parse_all ( ) . unwrap ( ) ;
// Execute the parsed nodes, passing them through a black box, to avoid over-optimizing by the compiler
c . bench_function ( "RegExp (Execution)" , move | b | {
@ -175,7 +185,9 @@ static ARRAY_ACCESS: &str = include_str!("bench_scripts/array_access.js");
fn array_access ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( ARRAY_ACCESS . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( ARRAY_ACCESS . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "Array access (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -187,7 +199,9 @@ static ARRAY_CREATE: &str = include_str!("bench_scripts/array_create.js");
fn array_creation ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( ARRAY_CREATE . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( ARRAY_CREATE . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "Array creation (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -199,7 +213,9 @@ static ARRAY_POP: &str = include_str!("bench_scripts/array_pop.js");
fn array_pop ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( ARRAY_POP . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( ARRAY_POP . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "Array pop (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -211,7 +227,9 @@ static STRING_CONCAT: &str = include_str!("bench_scripts/string_concat.js");
fn string_concat ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( STRING_CONCAT . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( STRING_CONCAT . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "String concatenation (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -223,7 +241,9 @@ static STRING_COMPARE: &str = include_str!("bench_scripts/string_compare.js");
fn string_compare ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( STRING_COMPARE . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( STRING_COMPARE . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "String comparison (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -235,7 +255,9 @@ static STRING_COPY: &str = include_str!("bench_scripts/string_copy.js");
fn string_copy ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( STRING_COPY . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( STRING_COPY . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
c . bench_function ( "String copy (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
@ -247,7 +269,7 @@ static NUMBER_OBJECT_ACCESS: &str = include_str!("bench_scripts/number_object_ac
fn number_object_access ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( NUMBER_OBJECT_ACCESS . as_bytes ( ) )
let nodes = Parser ::new ( NUMBER_OBJECT_ACCESS . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -261,7 +283,7 @@ static BOOLEAN_OBJECT_ACCESS: &str = include_str!("bench_scripts/boolean_object_
fn boolean_object_access ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( BOOLEAN_OBJECT_ACCESS . as_bytes ( ) )
let nodes = Parser ::new ( BOOLEAN_OBJECT_ACCESS . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -275,7 +297,7 @@ static STRING_OBJECT_ACCESS: &str = include_str!("bench_scripts/string_object_ac
fn string_object_access ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( STRING_OBJECT_ACCESS . as_bytes ( ) )
let nodes = Parser ::new ( STRING_OBJECT_ACCESS . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -289,7 +311,7 @@ static ARITHMETIC_OPERATIONS: &str = include_str!("bench_scripts/arithmetic_oper
fn arithmetic_operations ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( ARITHMETIC_OPERATIONS . as_bytes ( ) )
let nodes = Parser ::new ( ARITHMETIC_OPERATIONS . as_bytes ( ) , false )
. parse_all ( )
. unwrap ( ) ;
@ -302,7 +324,7 @@ static CLEAN_JS: &str = include_str!("bench_scripts/clean_js.js");
fn clean_js ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( CLEAN_JS . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( CLEAN_JS . as_bytes ( ) , false ) . parse_all ( ) . unwrap ( ) ;
c . bench_function ( "Clean js (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
} ) ;
@ -312,7 +334,7 @@ static MINI_JS: &str = include_str!("bench_scripts/mini_js.js");
fn mini_js ( c : & mut Criterion ) {
let mut engine = Context ::new ( ) ;
let nodes = Parser ::new ( MINI_JS . as_bytes ( ) ) . parse_all ( ) . unwrap ( ) ;
let nodes = Parser ::new ( MINI_JS . as_bytes ( ) , false ) . parse_all ( ) . unwrap ( ) ;
c . bench_function ( "Mini js (Execution)" , move | b | {
b . iter ( | | black_box ( & nodes ) . run ( & mut engine ) . unwrap ( ) )
} ) ;