From: Brian Candler Date: 2003-08-26T04:12:52+09:00 Subject: Re: Rite/Ruby2.0 & Ruby vs OCaml On Tue, Aug 26, 2003 at 02:09:04AM +0900, Martin Weber wrote: > On Tue, Aug 26, 2003 at 01:59:26AM +0900, Martin Weber wrote: > > print_string(string_of_num(sum 100000));; > *sigh* sorry. I've changed that to > > print_string(string_of_num(sum 1000000)); > > before I ran the tests of course. Cheers. And sorry I posted a buggy Ruby version too :-) $ ocamlc -o sum1 nums.cma sum.ml $ time ./sum1 500000500000 .. user 0m18.084s sys 0m0.025s $ ocamlopt -o sum2 nums.cmxa sum.ml $ time ./sum2 500000500000 .. user 0m5.672s sys 0m0.008s $ cat sum.rb def sum(n) total = 0 (1..n).each { |x| total += x } total end puts sum(1000000) $ time ruby sum.rb 500000500000 .. user 0m12.044s sys 0m0.055s So it seems Ruby's bignums are in the same ballpark performance-wise as Ocaml; and with the benefit of the code being far easier to write. Cheers, Brian.