[MLton] Re: [Haskell-cafe] fastest Fibonacci numbers in the West

William Lee Irwin III wli@holomorphy.com
Thu, 27 Jan 2005 11:22:48 -0800


On Thu, Jan 27, 2005 at 08:17:33PM +0100, Wesley W. Terpstra wrote:
> Confirmed.
> terpstra@carrot:~$ ulimit -s 81920
> terpstra@carrot:~$ time ./fib 99999999 > out
> real    3m18.830s
> user    3m17.097s
> sys     0m1.719s
> terpstra@carrot:~$ v out
> -rw-rw-r--  1 terpstra terpstra 20898765 Jan 27 20:11 out
> ... well that sucks. It also appears that setrlimit cannot increase a limit,
> so MLton's main() can't fix the issue short of making a new C call stack.
> I thought MLton used its own stack anyways? I have certainly written code in
> MLton that would overflow the mere 8MB stack that my system defaults to.

Setting up a stack by hand for C code to run on is trivial, but
interoperating with glibc isn't. The thread-local storage changes have
made stack switching a big hassle, where formerly it was trivial. I've
been burned by this in handwritten C a number of times recently.


-- wli