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 JAA26919; Fri, 7 Feb 2003 09:03:47 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA26654 for ; Fri, 7 Feb 2003 09:03:46 +0100 (MET) Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [217.110.154.194]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h1783jP23748 for ; Fri, 7 Feb 2003 09:03:45 +0100 (MET) Received: from bik-gmbh.de (prony.bik-gmbh.de [194.233.237.133]) by grisu.bik-gmbh.de (8.12.3/8.12.3) with ESMTP id h1783dU8061750; Fri, 7 Feb 2003 09:03:40 +0100 (CET) (envelope-from hars@bik-gmbh.de) Message-ID: <3E436850.4050300@bik-gmbh.de> Date: Fri, 07 Feb 2003 09:03:28 +0100 From: Florian Hars User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.1) Gecko/20020826 X-Accept-Language: de-de, en-us, en MIME-Version: 1.0 To: Oliver Bandel CC: caml-list@inria.fr Subject: Re: [Caml-list] Slow... very slow... References: <20030207010851.GA617@first.in-berlin.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Oliver Bandel wrote: > Why is the Ocaml-program so slow, The tool of choice if you don't understand where your program spends it's time isn't mutt, but gprof or ocamlprof. The main problem may be here: > let firstsplit = Str.bounded_split (Str.regexp "[ \t]+") line 3 If Str.regexp is implemented in the same way as Pcre.regexp (where I first encountered this problem), the compiler regards the call to the external C library prividing the regexp code as an unsafe operation that may have side effects and so must be repeated on every invocation of Str.bounded_split. Try moving it to the toplevel: let tabre = Str.regexp "[ \t]+" and then change all your functions to use it like: let firstsplit = Str.bounded_split tabre line 3 Yours, Florian. ------------------- 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