Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
tuning code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-03-03 (13:17)
From: Beck01, Wolfgang <BeckW@t...>
Subject: tuning code
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..


Next Generation IP Services and Systems
+49 6151 937 2863
Am Kavalleriesand 3
64295 Darmstadt