On Thu, 19 Aug 2010 07:52:33 -0400, Ethan Burns wrote: > > let r = ref 0.0 ;; > for i = 0 to 1000000000 do r := float i done; > Printf.printf "%f\n" !r; > Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words
To add a precision to others' answers : float refs are unboxed _locally_. If you rewrite your code as let r = ref 0.0 in for i = 0 to 1000_000_000 do r := float i done; Printf.printf "%f\n" !r; Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words then it runs at about the same speed as you other version. My 0.02€, C. _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs