Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'filename': 0.07; 'caching,': 0.09; 'runs,': 0.09; 'skip:f 30': 0.15; '-name': 0.16; '>to': 0.16; 'fnmatch': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'runs.': 0.16; 'runtime.': 0.16; 'simpson': 0.16; 'two.': 0.16; 'wrote:': 0.16; 'module,': 0.18; 'python?': 0.18; 'runs': 0.18; '(like': 0.23; 'cheers,': 0.24; 'header:In-Reply-To:1': 0.24; 'wondering': 0.25; 'testing': 0.25; 'header:User-Agent:1': 0.26; 'cpu': 0.29; 'i/o': 0.29; 'maybe': 0.31; 'code': 0.31; 'topic': 0.32; 'could': 0.35; 'to:addr:python-list': 0.35; 'really': 0.35; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.39; 'content- disposition:inline': 0.60; 'your': 0.60; 'more.': 0.62; 'cameron': 0.66; 'received:61': 0.72; 'gain': 0.81; 'cecil': 0.84; 'dumb': 0.84; 'received:120': 0.84; 'westerhof': 0.84 X-Authentication-Info: Submitted using ID cskk@bigpond.com X-Authority-Analysis: v=2.0 cv=D6DF24tj c=1 sm=1 a=9ZWvn/yWID2zgOSP3Z/tmg==:17 a=yEdEr6MRgwAA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=XAFQembCKUMA:10 a=3yIoFBagT-lbLZhyCjgA:9 a=CjuIK1q_8ugA:10 a=QLL-wnLyCYRNitPe:21 a=hKdxE99LhjOMbIDI:21 a=9ZWvn/yWID2zgOSP3Z/tmg==:117 Date: Sun, 7 Jun 2015 17:38:23 +1000 From: Cameron Simpson To: python-list@python.org Subject: Re: Find in ipython3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87sia4ox8h.fsf@Equus.decebal.nl> User-Agent: Mutt/1.5.23 (2014-03-12) References: <87sia4ox8h.fsf@Equus.decebal.nl> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433664199 news.xs4all.nl 2850 [2001:888:2000:d::a6]:35572 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92210 On 07Jun2015 08:20, Cecil Westerhof wrote: >There is no gain to get in standard Python? By switching from fnmatch >to re I got almost a speed gain of two. So I was wondering if I could >do more. Maybe write a few versions: one really dumb using filename == matchstring (like -name foo), one using filename.startswith(matchstring) (like -name '*foo'), one using matchstring in filename (like -name '*foo*') and your current one. See how much these affect the runtime. You _will_ need to make multiple identical runs (OSes do lots of caching, and other processes competing for I/O or the CPU will also perturb things). One the topic of multiple runs, have a look at the timeit module, psecificly designed for testing code with multiple runs. Cheers, Cameron Simpson