Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark refactor #640

Merged
merged 18 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boa/benches/bench_scripts/arithmetic_operations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((2 + 2) ** 3 / 100 - 5 ** 3 * -1000) ** 2 + 100 - 8
7 changes: 7 additions & 0 deletions boa/benches/bench_scripts/array_access.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function () {
let testArr = [1,2,3,4,5];

let res = testArr[2];

return res;
})();
8 changes: 8 additions & 0 deletions boa/benches/bench_scripts/array_create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function(){
let testArr = [];
for (let a = 0; a <= 500; a++) {
testArr[a] = ('p' + a);
}

return testArr;
})();
24 changes: 24 additions & 0 deletions boa/benches/bench_scripts/array_pop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function(){
let testArray = [83, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32,
45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828,
234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62,
99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67,
77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29,
2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28,
83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23, 56, 32,
56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36, 28, 93,
27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32, 45, 93,
17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234, 23,
56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99, 36,
28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32,
45, 93, 17, 28, 83, 62, 99, 36, 28, 93, 27, 29, 2828, 234,
23, 56, 32, 56, 67, 77, 32, 45, 93, 17, 28, 83, 62, 99,
36, 28, 93, 27, 29, 2828, 234, 23, 56, 32, 56, 67, 77, 32,
45, 93, 17, 28, 83, 62, 99, 36, 28];

while (testArray.length > 0) {
testArray.pop();
}

return testArray;
})();
7 changes: 7 additions & 0 deletions boa/benches/bench_scripts/boolean_object_access.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
new Boolean(
!new Boolean(
new Boolean(
!(new Boolean(false).valueOf()) && (new Boolean(true).valueOf())
).valueOf()
).valueOf()
).valueOf()
1 change: 1 addition & 0 deletions boa/benches/bench_scripts/expression.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 + 1 + 1 + 1 + 1 + 1 / 1 + 1 + 1 * 1 + 1 + 1 + 1;
10 changes: 10 additions & 0 deletions boa/benches/bench_scripts/fibonacci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(function () {
let num = 12;

function fib(n) {
if (n <= 1) return 1;
return fib(n - 1) + fib(n - 2);
}

return fib(num);
})();
10 changes: 10 additions & 0 deletions boa/benches/bench_scripts/for_loop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(function () {
let b = "hello";
for (let a = 10; a < 100; a += 5) {
if (a < 50) {
b += "world";
}
}

return b;
})();
7 changes: 7 additions & 0 deletions boa/benches/bench_scripts/goal_symbol_switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function foo(regex, num) {}

let i = 0;
while (i < 1000000) {
foo(/ab+c/, 5.0/5);
i++;
}
1 change: 1 addition & 0 deletions boa/benches/bench_scripts/hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let foo = 'hello world!'; foo;
9 changes: 9 additions & 0 deletions boa/benches/bench_scripts/long_repetition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for (let a = 10; a < 100; a++) {
if (a < 10) {
console.log("impossible D:");
} else if (a < 50) {
console.log("starting");
} else {
console.log("finishing");
}
}
7 changes: 7 additions & 0 deletions boa/benches/bench_scripts/number_object_access.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
new Number(
new Number(
new Number(
new Number(100).valueOf() - 10.5
).valueOf() + 100
).valueOf() * 1.6
)
8 changes: 8 additions & 0 deletions boa/benches/bench_scripts/object_creation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function () {
let test = {
my_prop: "hello",
another: 65,
};

return test;
})();
8 changes: 8 additions & 0 deletions boa/benches/bench_scripts/object_prop_access_const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function () {
let test = {
my_prop: "hello",
another: 65,
};

return test.my_prop;
})();
8 changes: 8 additions & 0 deletions boa/benches/bench_scripts/object_prop_access_dyn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function () {
let test = {
my_prop: "hello",
another: 65,
};

return test["my" + "_prop"];
})();
5 changes: 5 additions & 0 deletions boa/benches/bench_scripts/regexp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
let regExp = new RegExp('hello', 'i');

return regExp.test("Hello World");
})();
5 changes: 5 additions & 0 deletions boa/benches/bench_scripts/regexp_creation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
let regExp = new RegExp('hello', 'i');

return regExp;
})();
5 changes: 5 additions & 0 deletions boa/benches/bench_scripts/regexp_literal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
let regExp = /hello/i;

return regExp.test("Hello World");
})();
5 changes: 5 additions & 0 deletions boa/benches/bench_scripts/regexp_literal_creation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
let regExp = /hello/i;

return regExp;
})();
9 changes: 9 additions & 0 deletions boa/benches/bench_scripts/string_compare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function(){
var a = "hello";
var b = "world";

var c = a == b;

var d = b;
var e = d == b;
})();
6 changes: 6 additions & 0 deletions boa/benches/bench_scripts/string_concat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(function(){
var a = "hello";
var b = "world";

var c = a + b;
})();
4 changes: 4 additions & 0 deletions boa/benches/bench_scripts/string_copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(function(){
var a = "hello";
var b = a;
})();
7 changes: 7 additions & 0 deletions boa/benches/bench_scripts/string_object_access.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
new String(
new String(
new String(
new String('Hello').valueOf() + new String(", world").valueOf()
).valueOf() + '!'
).valueOf()
).valueOf()
3 changes: 3 additions & 0 deletions boa/benches/bench_scripts/symbol_creation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function () {
return Symbol();
})();
Loading