Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92210

Re: Find in ipython3

Date 2015-06-07 17:38 +1000
From Cameron Simpson <cs@zip.com.au>
Subject Re: Find in ipython3
References <87sia4ox8h.fsf@Equus.decebal.nl>
Newsgroups comp.lang.python
Message-ID <mailman.232.1433664199.13271.python-list@python.org> (permalink)

Show all headers | View raw


On 07Jun2015 08:20, Cecil Westerhof <Cecil@decebal.nl> 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 <cs@zip.com.au>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-02 18:13 +0200
  Re: Find in ipython3 Cameron Simpson <cs@zip.com.au> - 2015-06-04 12:54 +1000
    Re: Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-04 07:09 +0200
      Re: Find in ipython3 Cameron Simpson <cs@zip.com.au> - 2015-06-04 15:43 +1000
      Re: Find in ipython3 Grant Edwards <invalid@invalid.invalid> - 2015-06-04 14:27 +0000
        Re: Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-04 17:12 +0200
          Re: Find in ipython3 Michael Torrie <torriem@gmail.com> - 2015-06-04 13:11 -0600
  Re: Find in ipython3 Michael Torrie <torriem@gmail.com> - 2015-06-04 13:09 -0600
  Re: Find in ipython3 Tim Chase <python.list@tim.thechases.com> - 2015-06-04 14:17 -0500
  Re: Find in ipython3 random832@fastmail.us - 2015-06-04 16:13 -0400
    Re: Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-05 09:17 +0200
      Re: Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-06 11:57 +0200
        Re: Find in ipython3 Laura Creighton <lac@openend.se> - 2015-06-06 13:07 +0200
          Re: Find in ipython3 Cecil Westerhof <Cecil@decebal.nl> - 2015-06-07 08:20 +0200
            Re: Find in ipython3 Cameron Simpson <cs@zip.com.au> - 2015-06-07 17:38 +1000
            Re: Find in ipython3 Laura Creighton <lac@openend.se> - 2015-06-07 11:33 +0200
              Re: Find in ipython3 Steven D'Aprano <steve@pearwood.info> - 2015-06-07 23:16 +1000
            Re: Find in ipython3 Peter Otten <__peter__@web.de> - 2015-06-07 12:27 +0200
            Re: Find in ipython3 Laura Creighton <lac@openend.se> - 2015-06-07 15:01 +0200
            Re: Find in ipython3 Chris Angelico <rosuav@gmail.com> - 2015-06-07 22:13 +1000

csiph-web