Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'result,': 0.05; 'slow.': 0.09; 'maintainable': 0.16; 'subject:search': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.17; 'tests': 0.18; 'mostly': 0.20; 'to:2**1': 0.23; 'second': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:> 10': 0.27; 'subject:/': 0.28; 'i/o': 0.29; 'that.': 0.30; 'to:addr:python- list': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'faster': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'message-id:@gmail.com': 0.36; 'charset:us-ascii': 0.36; 'being': 0.37; 'quite': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'think': 0.40; 'skip:u 10': 0.60; 'more': 0.63; 'show': 0.63; 'dispute': 0.84; 'subject:via': 0.84; 'gladly': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:user-agent:date:subject:from:to:message-id:thread-topic :in-reply-to:mime-version:content-type:content-transfer-encoding; bh=fo9DPn0+IL77Quexq2ls09+y3WMhNVIYD8eOvYbKHMU=; b=w5iNaLE1ZzXks3xteBZsneySKVJYcPXYmGtwTE61mmUh8VplaEbHjx9s5U4jtXhxmt cUmEiqN1wkMakZtlR9nckq8Tn7lqLTv8utmTXmWVuIRJ8l1uUQMbUEJ0Evr3UJLTyCa2 863GqYp/pqkY2R03So1jQppTMgNOQdOrSNY8GuY3S3r+nj+8UW7utGSKgM3lAX2ClMuk ltOha6gr2RX575WLEY19jXJLMMkTVHIGuq3n1DyjWYK9j/V9MnbPjJqwrzpcCWj2sumI vlQDwPHWxDOqVDh9jdrEs9sy9kam3gTf9GzyIx8zYGcqu+e1hfmoiT3Rjurg0HfwnhBZ aSBA== X-Received: by 10.66.84.232 with SMTP id c8mr6884804paz.8.1360249712406; Thu, 07 Feb 2013 07:08:32 -0800 (PST) User-Agent: Microsoft-MacOutlook/14.3.0.121105 Date: Thu, 07 Feb 2013 07:08:23 -0800 Subject: Re: Curious to see alternate approach on a search/replace via regex From: Demian Brecht To: Steven D'Aprano , Thread-Topic: Curious to see alternate approach on a search/replace via regex In-Reply-To: <511319c7$0$21812$c3e8da3$76491128@news.astraweb.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360249721 news.xs4all.nl 6990 [2001:888:2000:d::a6]:33444 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38352 On 2013-02-06 7:04 PM, "Steven D'Aprano" wrote: >I dispute those results. I think you are mostly measuring the time to >print the result, and I/O is quite slow. Good call, hadn't even considered that. >My tests show that using urlparse >is 33% faster than using regexes, and far more understandable and >maintainable. Couldn't agree more about it being more maintainable and on second thought would gladly give up a negligible performance hit for it.