Re:Emacs-ng: Emacs with Deno runtime and TypeScript
by vitus on Tuesday March 16, 2021 @09:14PM
(#26485377)
There, that runtime is roughly O(n^2) when dealing with bignums, since addition scales linearly with bit length of the operands, and bit length increases linearly with the number of iterations (~0.7 bits per iteration).
Which is still not fast -- on my laptop, Python takes about 9s for fib(1000000). But compared to an exponentially-growing function, that's a blink of an eye.
That is, knowing all of these facts, it is still impressive how fast you can get (fib 1000000) using iteration and bignums.