Find in ipython3

Cecil Westerhof Cecil at decebal.nl
Sun Jun 7 02:20:46 EDT 2015


On Saturday  6 Jun 2015 13:07 CEST, Laura Creighton wrote:

> The !find version is C code optimised to do one thing, find files in
> your directory structure, which happens to be what you want to do.
> General regular expression matching is harder.
>
> Carl Friedrich Bolz investigated regular expression algorithms and
> their implementation to see if this is the sort of task that a JIT
> can improve. He blogged about it in 2 posts (part1 and part2). There
> are benchmarks for part2. Benchmarks in part2.
>
> see:
> http://morepypy.blogspot.se/2010/05/efficient-and-elegant-regular.html
> http://morepypy.blogspot.se/2010/06/jit-for-regular-expression-matching.html
>
> 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’.

It is of-course not a very big program. The difference is significant,
but I do not use find that much. And if it is significant I still can
use the shell version.

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.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list