All pastes #44390 Raw Edit

Anonymous

public text v1 · immutable
#44390 ·published 2006-03-04 00:12 UTC
rendered paste body
There was a piece of ocaml code that had to deal with 2 million records. It
was compiled with ocamlopt 3.08.3.

Without optimisations, it took 135 s to process them, on a 3 GHz Intel Pentium 4.
After profiling and setting Gc.space_overhead to 480, it only took 88 s.

fscanf consumed many cycles but was not really necessary, so it was replaced by
something simpler. Now the program did it in 22 s.

Replacing a Hashtbl with a Map made it only slightly worse: 25 s.

After reverting to a Hashtbl and removing the -p option, it took 8.2 s.

Not bad for a functional language..


Wolfgang