Skip to content

Commit

Permalink
Refactor old function with new function object (#255)
Browse files Browse the repository at this point in the history
Co-authored-by: Iban Eguia <[email protected]>

Co-authored-by: Jason Williams <[email protected]>
Co-authored-by: Iban Eguia <[email protected]>
  • Loading branch information
3 people authored May 3, 2020
1 parent 55ef44c commit f02babf
Show file tree
Hide file tree
Showing 26 changed files with 1,082 additions and 821 deletions.
66 changes: 16 additions & 50 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
"type": "process",
"label": "Cargo Run",
"command": "cargo",
"args": [
"run",
"./tests/js/test.js"
],
"problemMatcher": [
"$rustc"
],
"args": ["run", "./tests/js/test.js"],
"problemMatcher": ["$rustc"],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"env": { "RUST_BACKTRACE": "full" }
},
"presentation": {
"clear": true
}
Expand All @@ -26,19 +24,9 @@
"type": "process",
"label": "Get Tokens",
"command": "cargo",
"args": [
"run",
"--",
"-t=Debug",
"./tests/js/test.js"
],
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
},
"args": ["run", "--", "-t=Debug", "./tests/js/test.js"],
"problemMatcher": ["$rustc"],
"group": "build",
"presentation": {
"clear": true
}
Expand All @@ -47,19 +35,9 @@
"type": "process",
"label": "Get AST",
"command": "cargo",
"args": [
"run",
"--",
"-a=Debug",
"./tests/js/test.js"
],
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
},
"args": ["run", "--", "-a=Debug", "./tests/js/test.js"],
"problemMatcher": ["$rustc"],
"group": "build",
"presentation": {
"clear": true
}
Expand All @@ -68,12 +46,8 @@
"type": "process",
"label": "Cargo Test",
"command": "cargo",
"args": [
"test"
],
"problemMatcher": [
"$rustc"
],
"args": ["test"],
"problemMatcher": ["$rustc"],
"group": {
"kind": "test",
"isDefault": true
Expand All @@ -86,17 +60,9 @@
"type": "process",
"label": "Cargo Test Build",
"command": "cargo",
"args": [
"test",
"--no-run"
],
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
"args": ["test", "--no-run"],
"problemMatcher": ["$rustc"],
"group": "build"
}
]
}
43 changes: 22 additions & 21 deletions boa/benches/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,30 @@ fn symbol_creation(c: &mut Criterion) {
});
}

static FOR_LOOP: &str = r#"
let a = 10;
let b = "hello";
for (;;) {
a += 5;
// TODO: implement for loops.
// static FOR_LOOP: &str = r#"
// let a = 10;
// let b = "hello";
// for (;;) {
// a += 5;

if a < 50 {
b += "world";
}
// if (a < 50) {
// b += "world";
// }

if (a > 100) {
break;
}
}
let c = a;
let d = b;
"#;
// if (a > 100) {
// break;
// }
// }
// let c = a;
// let d = b;
// "#;

fn for_loop_execution(c: &mut Criterion) {
c.bench_function("For loop (Execution)", move |b| {
b.iter(|| exec(black_box(FOR_LOOP)))
});
}
// fn for_loop_execution(c: &mut Criterion) {
// c.bench_function("For loop (Execution)", move |b| {
// b.iter(|| exec(black_box(FOR_LOOP)))
// });
// }

static FIBONACCI: &str = r#"
let num = 12;
Expand All @@ -73,7 +74,7 @@ criterion_group!(
execution,
create_realm,
symbol_creation,
for_loop_execution,
// for_loop_execution,
fibonacci
);
criterion_main!(execution);
Loading

0 comments on commit f02babf

Please sign in to comment.