By not cloning code for recursion directly into the processing buffer and by not copying as many strings and by not doing string->int conversions all the time, it's significantly faster. Specifically, it's about 5.5x slower than Python.
48 lines
310 B
Plaintext
48 lines
310 B
Plaintext
fib
|
|
{
|
|
@dup
|
|
@not
|
|
@if
|
|
@drop 1
|
|
@else
|
|
@dup
|
|
@i_dec
|
|
@not
|
|
@if
|
|
@drop 1
|
|
@else
|
|
@i_dec
|
|
@dup
|
|
@i_dec
|
|
@fib
|
|
@swap
|
|
@fib
|
|
@i_add
|
|
@endif
|
|
@endif
|
|
}
|
|
|
|
do_fibs
|
|
{
|
|
@dup
|
|
@if
|
|
@dup
|
|
@i_dec
|
|
@do_fibs
|
|
@fib
|
|
@print
|
|
@else
|
|
0
|
|
@endif
|
|
}
|
|
|
|
junk
|
|
{
|
|
12 @dup @print @fib @print
|
|
}
|
|
|
|
|
|
39 @do_fibs
|
|
|
|
|