-
Notifications
You must be signed in to change notification settings - Fork 11
/
equality.lox
34 lines (26 loc) · 777 Bytes
/
equality.lox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;