Building off of https://github.com/lilactown/pyramid/pull/15, this PR rewrites the essential algorithm to use continuation-passing style and trampoline in order to avoid using the call stack.
On my personal laptop, this results in slighty slower runtime than the one in #15 using the callstack, but descends over 40,000 before overflowing vs a measly ~3,000, and is still faster than the broken version in the main branch.
Building off of https://github.com/lilactown/pyramid/pull/15, this PR rewrites the essential algorithm to use continuation-passing style and trampoline in order to avoid using the call stack.
On my personal laptop, this results in slighty slower runtime than the one in #15 using the callstack, but descends over 40,000 before overflowing vs a measly ~3,000, and is still faster than the broken version in the
main
branch.