Find in ipython3

Laura Creighton lac at openend.se
Sun Jun 7 05:33:43 EDT 2015


In a message of Sun, 07 Jun 2015 08:20:46 +0200, Cecil Westerhof writes:
>> You may get faster results if you use Matthew Barnett's replacement
>> for re here: https://pypi.python.org/pypi/regex
>>
>> You will get faster results if you build your IPython shell to use
>> PyPy, but I would still be very surprised if it beat the C program
>> find.
>
>I have to look into that. But I prefer to write a version that can be
>used by ‘everyone’.

Well, everybody can download Matthew Barnett's regex, and get pypy,
and the claim is that ipython just works with pypy, and if it ever doesn't
the ipython team wants a bug report, so I am not sure what you mean by
'used by "everyone"' here that these don't have.

>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.

That's because speeding up regular expression matching is something
that people have put a significant amount of effort in, but under the
hood, so to speak.  Other modules are likely to be slower, as people
haven't gone to so much effort to make them fast.

You have reached the point where, if your python code is too slow, and
you don't want to use PyPy, people go grab Cython (or Boost or Swig, but
Cython is a whole lot easier and more fun to use) and make themselves
a C extension.  Which you can, of course, do as part of your voyage
of discovery.

But I am still betting that it won't perform as well as the linux utility
find. :)

Laura




More information about the Python-list mailing list