Results (with gcc 4.2 -03 -mtune=native -DNDEBUG, head Go -B, Ocamlopt 3.12.0 -unsafe -rectypes -inline 1000):
C++: 0m0.611s
OCaml: 0m1.457s
Go: 0m1.043s
This is on a Macbook Pro 2.53 Ghz Core 2 Duo running OS X 10.5.8.
Go source: http://pastie.org/2199969
(With a trivial optimization, the Go version can be improved by ~13%, but I decided not to do that because it'd be a slightly different algorithm.)
Time: 0m0.796s
May want to use that instead.
Results (with gcc 4.2 -03 -mtune=native -DNDEBUG, head Go -B, Ocamlopt 3.12.0 -unsafe -rectypes -inline 1000):
C++: 0m0.611s
OCaml: 0m1.457s
Go: 0m1.043s
This is on a Macbook Pro 2.53 Ghz Core 2 Duo running OS X 10.5.8.
Go source: http://pastie.org/2199969
(With a trivial optimization, the Go version can be improved by ~13%, but I decided not to do that because it'd be a slightly different algorithm.)