[Shootout-list] nsieve implementations in C, OCaml, Python, and Scheme

Dima Dorfman d+shootout@trit.org
Sat, 18 Dec 2004 12:06:34 +0000


Brent Fulgham <bfulgham@debian.org> wrote:
> On Tuesday 14 December 2004 06:35 am, Dima Dorfman wrote:
> >   http://www.trit.org/~dima/home/nsieve/nsieve.c
> >   http://www.trit.org/~dima/home/nsieve/nsieve.ml
> 
> Thanks -- I've applied the Python, C, and Scheme tests (I already
> had an OCaml implementation).

Thanks. Per Issac's request, I made separate versions for the
nsieve-bits test in the sandbox. They're here:

  http://www.trit.org/~dima/home/nsieve/nsieve_bits.c
  http://www.trit.org/~dima/home/nsieve/nsieve_bits.ml

The non-_bits versions were updated to remove the bits version of the
function, so the line count is lower. FWIW, this OCaml version is
slightly faster (about 6% in my tests) than the one currently on the
site. I'm surprised, though, that there is such a discrepancy between
the gcc and OCaml CPU times on the web site; they're very close on my
system, even with the existing OCaml implementation.