Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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..


Wolfgang

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