mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 12:32: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
106
lox.t/benchmark/properties.lox
Normal file
106
lox.t/benchmark/properties.lox
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// This benchmark stresses both field and method lookup.
|
||||
|
||||
class Foo {
|
||||
init() {
|
||||
this.field0 = 1;
|
||||
this.field1 = 1;
|
||||
this.field2 = 1;
|
||||
this.field3 = 1;
|
||||
this.field4 = 1;
|
||||
this.field5 = 1;
|
||||
this.field6 = 1;
|
||||
this.field7 = 1;
|
||||
this.field8 = 1;
|
||||
this.field9 = 1;
|
||||
this.field10 = 1;
|
||||
this.field11 = 1;
|
||||
this.field12 = 1;
|
||||
this.field13 = 1;
|
||||
this.field14 = 1;
|
||||
this.field15 = 1;
|
||||
this.field16 = 1;
|
||||
this.field17 = 1;
|
||||
this.field18 = 1;
|
||||
this.field19 = 1;
|
||||
this.field20 = 1;
|
||||
this.field21 = 1;
|
||||
this.field22 = 1;
|
||||
this.field23 = 1;
|
||||
this.field24 = 1;
|
||||
this.field25 = 1;
|
||||
this.field26 = 1;
|
||||
this.field27 = 1;
|
||||
this.field28 = 1;
|
||||
this.field29 = 1;
|
||||
}
|
||||
|
||||
method0() { return this.field0; }
|
||||
method1() { return this.field1; }
|
||||
method2() { return this.field2; }
|
||||
method3() { return this.field3; }
|
||||
method4() { return this.field4; }
|
||||
method5() { return this.field5; }
|
||||
method6() { return this.field6; }
|
||||
method7() { return this.field7; }
|
||||
method8() { return this.field8; }
|
||||
method9() { return this.field9; }
|
||||
method10() { return this.field10; }
|
||||
method11() { return this.field11; }
|
||||
method12() { return this.field12; }
|
||||
method13() { return this.field13; }
|
||||
method14() { return this.field14; }
|
||||
method15() { return this.field15; }
|
||||
method16() { return this.field16; }
|
||||
method17() { return this.field17; }
|
||||
method18() { return this.field18; }
|
||||
method19() { return this.field19; }
|
||||
method20() { return this.field20; }
|
||||
method21() { return this.field21; }
|
||||
method22() { return this.field22; }
|
||||
method23() { return this.field23; }
|
||||
method24() { return this.field24; }
|
||||
method25() { return this.field25; }
|
||||
method26() { return this.field26; }
|
||||
method27() { return this.field27; }
|
||||
method28() { return this.field28; }
|
||||
method29() { return this.field29; }
|
||||
}
|
||||
|
||||
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