From: Jon Harrop Date: 2006-08-04T11:00:12+09:00 Subject: Re: For performance, write it in OCaml William James wrote: > Here's a faster version of my program. > > Eliminated a "not" in a loop by replacing the array of booleans > that shows incompatibility of two rows with an array that shows > compatibility. Heh, should've thought of that. :-) > Borrowed you idea of creating an output line ahead of time and > modifying it in place. > > Timings: > 1.11 yours > 1.04 mine I get the opposite order: 0.394s yours 0.390s mine but your timings are probably more accurate because your computer is so slow. ;-) You can make it slightly faster by factoring out the CSE "compatible (latest)", giving: 0.382s That's actually faster than the C here. Woohoo! :-) Using bitvectors may also improve things, depending if skipping a bunch of comparisons in that loop is significant. However, I think it is time we searched for a new task to optimise. Ray tracer anyone? ;-) -- Dr Jon D Harrop, Flying Frog Consultancy Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists