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 BAA30409; Thu, 15 May 2003 01:13:28 +0200 (MET DST) 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 BAA29914 for ; Thu, 15 May 2003 01:13:27 +0200 (MET DST) Received: from swordfish ([216.241.35.41]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4ENDQH04476 for ; Thu, 15 May 2003 01:13:26 +0200 (MET DST) Received: from matt by swordfish with local (Exim 3.35 #1 (Debian)) id 19G5R8-0007eq-00 for ; Wed, 14 May 2003 17:13:26 -0600 Date: Wed, 14 May 2003 17:13:26 -0600 From: Matt Gushee To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Performance problem Message-ID: <20030514231326.GD27927@swordfish> Reply-To: Matt Gushee Mail-Followup-To: caml-list@pauillac.inria.fr References: <20030514210332.GA27927@swordfish> <55DB7CE4-8659-11D7-9845-000393863F70@exomi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55DB7CE4-8659-11D7-9845-000393863F70@exomi.com> User-Agent: Mutt/1.3.27i X-Spam: no; 0.00; gushee:01 mgushee:01 havenrock:01 caml-list:01 slower:01 non-trivial:01 python:01 newbies:01 englewood:01 manure:01 ignores:01 --lao:01 merel:01 match:02 ambiguous:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, May 15, 2003 at 01:13:48AM +0300, Ville-Pertti Keinonen wrote: > > Regular expressions can be much slower than you might expect for > non-trivial cases. The expression in your program looks particularly > nasty, since there are a lot of ambiguous cases (whether '-' should > match '.*' or '-' depends on everything that follows). > > You might want to try using Str.split instead. Yes, that works well. Considering the number of times I've seen Python gurus admonishing newbies to use simple string functions instead of regexes whenever possible (and have probably admonished a few myself), you'd think I would have thought of that. But all's well that ends well, I guess. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- 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