]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/fib1/fib1.factor
factor: trim using lists
[factor.git] / extra / benchmark / fib1 / fib1.factor
1 USING: math.private kernel ;
2 IN: benchmark.fib1
3
4 : fast-fixnum-fib ( m -- n )
5     dup 1 fixnum<= [
6         drop 1
7     ] [
8         1 fixnum-fast dup fast-fixnum-fib
9         swap 1 fixnum-fast fast-fixnum-fib fixnum+fast
10     ] if ;
11
12 : fib1-benchmark ( -- ) 34 fast-fixnum-fib 9227465 assert= ;
13
14 MAIN: fib1-benchmark