"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] <snip - timing and sample code, comparing pyparsing (test3) with comparable regexp (test4)> > > > timeit -s "import test" "test.test3()" > 100 loops, best of 3: 6.73 msec per loop > > > timeit -s "import test" "test.test4()" > 10000 loops, best of 3: 27.8 usec per loop > > that's a 240x slowdown. hmm. > > </F> > > Well, what of it? How fast does it have to be? Is it a one-shot conversion? People tend to be willing to wait a bit longer for one-time conversion programs. What else is going on in this program? Is this the bottleneck? Are we reading the input over the Internet through HTTP?
If I'm running this program and waiting for the results, 7 msec isn't perceptibly slower than 28 usec - both are going to seem pretty much instantaneous. On the other hand, if I'm processing 100 files, then this goes up to, um, .7 sec vs 3 msec. There is no question, regexp's beat the pants off of pyparsing in raw performance. But this newsgroup has visited the raw performance issue many times in the past, usually when responding to the "Python can't be very fast, it's interpreted" argument. Raw performance is just one aspect in determining suitability of a given technical approach. -- Paul -- http://mail.python.org/mailman/listinfo/python-list