mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
added lox test files
This commit is contained in:
parent
821f5c62bc
commit
0f3d0a15f0
268 changed files with 7497 additions and 3 deletions
73
lox.t/benchmark/invocation.lox
Normal file
73
lox.t/benchmark/invocation.lox
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// This benchmark stresses just method invocation.
|
||||
|
||||
class Foo {
|
||||
method0() {}
|
||||
method1() {}
|
||||
method2() {}
|
||||
method3() {}
|
||||
method4() {}
|
||||
method5() {}
|
||||
method6() {}
|
||||
method7() {}
|
||||
method8() {}
|
||||
method9() {}
|
||||
method10() {}
|
||||
method11() {}
|
||||
method12() {}
|
||||
method13() {}
|
||||
method14() {}
|
||||
method15() {}
|
||||
method16() {}
|
||||
method17() {}
|
||||
method18() {}
|
||||
method19() {}
|
||||
method20() {}
|
||||
method21() {}
|
||||
method22() {}
|
||||
method23() {}
|
||||
method24() {}
|
||||
method25() {}
|
||||
method26() {}
|
||||
method27() {}
|
||||
method28() {}
|
||||
method29() {}
|
||||
}
|
||||
|
||||
var foo = Foo();
|
||||
var start = clock();
|
||||
var i = 0;
|
||||
while (i < 500000) {
|
||||
foo.method0();
|
||||
foo.method1();
|
||||
foo.method2();
|
||||
foo.method3();
|
||||
foo.method4();
|
||||
foo.method5();
|
||||
foo.method6();
|
||||
foo.method7();
|
||||
foo.method8();
|
||||
foo.method9();
|
||||
foo.method10();
|
||||
foo.method11();
|
||||
foo.method12();
|
||||
foo.method13();
|
||||
foo.method14();
|
||||
foo.method15();
|
||||
foo.method16();
|
||||
foo.method17();
|
||||
foo.method18();
|
||||
foo.method19();
|
||||
foo.method20();
|
||||
foo.method21();
|
||||
foo.method22();
|
||||
foo.method23();
|
||||
foo.method24();
|
||||
foo.method25();
|
||||
foo.method26();
|
||||
foo.method27();
|
||||
foo.method28();
|
||||
foo.method29();
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
print clock() - start;
|
||||
Loading…
Add table
Add a link
Reference in a new issue