mlox/benchmark/equality.lox

34 lines
777 B
Lox

var i = 0;
var loopStart = clock();
while (i < 10000000) {
i = i + 1;
1; 1; 1; 2; 1; nil; 1; "str"; 1; true;
nil; nil; nil; 1; nil; "str"; nil; true;
true; true; true; 1; true; false; true; "str"; true; nil;
"str"; "str"; "str"; "stru"; "str"; 1; "str"; nil; "str"; true;
}
var loopTime = clock() - loopStart;
var start = clock();
i = 0;
while (i < 10000000) {
i = i + 1;
1 == 1; 1 == 2; 1 == nil; 1 == "str"; 1 == true;
nil == nil; nil == 1; nil == "str"; nil == true;
true == true; true == 1; true == false; true == "str"; true == nil;
"str" == "str"; "str" == "stru"; "str" == 1; "str" == nil; "str" == true;
}
var elapsed = clock() - start;
print "loop";
print loopTime;
print "elapsed";
print elapsed;
print "equals";
print elapsed - loopTime;