regular expressions ... slow
kay.schluehr at gmx.net
Wed Nov 19 10:04:29 CET 2008
On 18 Nov., 18:47, Stefan Behnel <stefan... at behnel.de> wrote:
> Kay Schluehr wrote:
> > All of this is prototyped in Python and it is still work in progress.
> > As long as development has not reached a stable state I refuse to
> > rebuild the system in an optimized C version.
> And rightfully so:
> 1) the approach is algorithmically better, so it may even beat the current
> C implementation by design.
> 2) switching languages before finishing and benchmarking the prototype is a
> premature optimisation. It wouldn't be the first prototype going into
> 3) even before considering a reimplementation, you should throw it into
> Cython to translate it into C code, and then benchmark that.
I fully agree and in fact the Trail parser generator contains a single
extension module called cyTrail which is written in Cython - it's not
just a trivial recompilation of Python in Cython but it uses all kinds
There is just a difference between optimizing existing code using the
best techniques available and writing code from scratch for speed. I
consider this as a different, subsequent project ( call it cTrail )
and I want to have more fine control than being possible with Cython -
actually I do want to understand the code in a simple language as C. I
have to idea what the code does, generated by Cython. There are entire
layers that can be stripped off when not dealing with Python types and
dynamic memory allocation.
More information about the Python-list