From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 27062BBBB for ; Fri, 3 Mar 2006 14:17:24 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k23DHNTH002925 for ; Fri, 3 Mar 2006 14:17:23 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA12835 for ; Fri, 3 Mar 2006 14:17:23 +0100 (MET) Received: from tcmail22.telekom.de (tcmail22.telekom.de [217.6.95.236]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k23DHMG4002921 for ; Fri, 3 Mar 2006 14:17:23 +0100 Received: from g9jbr.mgb01.telekom.de (g9jbr.mgb01.telekom.de [164.20.31.6]) by tcmail21.dmz.telekom.de with ESMTP for caml-list@inria.fr; Fri, 3 Mar 2006 14:17:16 +0100 Received: by G9JBR.mgb01.telekom.de with Internet Mail Service (5.5.2653.19) id ; Fri, 3 Mar 2006 14:17:16 +0100 Message-Id: <1E4CCB2441C5C0409AD8A929482A09F31BB67E@S4DE9JSAAIG.ost.t-com.de> From: "Beck01, Wolfgang" To: caml-list@inria.fr Subject: tuning code Date: Fri, 3 Mar 2006 14:17:08 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Miltered: at nez-perce with ID 440841E3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 440841E2.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; t-systems:01 ocaml:01 ocamlopt:01 replacing:01 hashtbl:01 hashtbl:01 t-systems:01 6151:01 darmstadt:01 simpler:01 slightly:02 functional:02 wolfgang:02 wolfgang:02 overhead:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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