From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA14634; Wed, 8 Jan 2003 02:57:17 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA14719 for ; Wed, 8 Jan 2003 02:57:16 +0100 (MET) Received: from igw2.watson.ibm.com (igw2.watson.ibm.com [129.34.20.6]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h081vFr09955 for ; Wed, 8 Jan 2003 02:57:15 +0100 (MET) Received: from sp1n293en1.watson.ibm.com (sp1n293en1.watson.ibm.com [9.2.112.57]) by igw2.watson.ibm.com (8.11.4/8.11.4) with ESMTP id h081v2c08272; Tue, 7 Jan 2003 20:57:02 -0500 Received: from nautilus-chet.watson.ibm.com (sig-9-65-111-160.mts.ibm.com [9.65.111.160]) by sp1n293en1.watson.ibm.com (8.11.4/8.11.4) with ESMTP id h081v1T965368; Tue, 7 Jan 2003 20:57:02 -0500 Received: from maine (maine [127.0.0.1]) by nautilus-chet.watson.ibm.com (8.12.5/8.12.5/Debian-1) with ESMTP id h05BZHiY009447; Sun, 5 Jan 2003 06:35:18 -0500 Message-Id: <200301051135.h05BZHiY009447@nautilus-chet.watson.ibm.com> To: =?ISO-8859-1?Q?J=F6rgen_Gustavsson?= cc: caml-list@inria.fr Subject: Re: [Caml-list] Memory management dominates running time In-Reply-To: Your message of "Fri, 03 Jan 2003 22:58:34 +0100." References: Date: Sun, 05 Jan 2003 06:35:17 -0500 From: Chet Murthy Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk By using gprof, and doing a little careful counting, you can often find out where egregious allocations are happening, and eliminate them. I can't give you good pointers on this, because, well, it's a bit of an art, and takes a lot of experience. But it _is_ doable, and I have done it to nontrivial programs in Caml, as well as in Java, attaining speedups of 2x, 3x, without much code-restructuring. E.g., once, I took a Stream-based parser, and wrote a Stream module which only supported "char Stream", and only for parsing. By writing a few auxiliary functions in addition to this, I was able to reduce the consing associated with stream-based parsing (the constant creation of "Some _" blocks) significantly, and got a rather large speedup. I was able to see that this was important, basically by looking around in the gprof profile and trying to follow where the allocation were happening. --chet-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners