factorial benchmark
This commit is contained in:
parent
af2f639ccc
commit
0c4a6553ff
|
@ -0,0 +1,14 @@
|
|||
var fact = funct(n)
|
||||
if (n > 0)
|
||||
:result = n * fact(n-1)
|
||||
else
|
||||
:result = 1
|
||||
;
|
||||
|
||||
var i = 0;
|
||||
var res = 0;
|
||||
while (i < 50000) {
|
||||
res = res + fact(50);
|
||||
i = i + 1;
|
||||
};
|
||||
print res;
|
|
@ -65,6 +65,7 @@ proc DU8ptrToInt*(du8: ptr uint8): int =
|
|||
cast[ptr uint16](du8)[].int
|
||||
|
||||
proc findConstant(ch: var Chunk, constant: NdValue): int =
|
||||
# TODO, if there are a lot of constants that are different, this could be possibly slow, so either use a table lookup or only check for the last x constants
|
||||
if ch.constants.len() == 0:
|
||||
return -1
|
||||
for i in countup(0, ch.constants.high()):
|
||||
|
|
Loading…
Reference in New Issue