Re: [Pyparsing] parsing with operatorPrecedence takes too much time
Brought to you by:
ptmcg
From: Joshua J. K. <jk...@sk...> - 2008-04-02 17:31:20
|
On Wed, 2008-04-02 at 18:33 +0200, Ralf Schmitt wrote: > Hi all, > > I'm attaching a short test program that tries to parse mathematical > expressions using operatorPrecedence. > It takes nearly one second to parse a simple expression like 1+1+1-(5+2) (on > a 2.4Ghz machine). You forgot to attach it. :) When you say "takes nearly one second" do you mean for the python script to start up, initialize, parse, and exit? Or one second just for parsing? Have you tried *just* the parsing routine under something like timeit? Check my code against the timeit docs, but something like this: t = timeit("parse_exp.parseString('1+1+1-(5+2)')", setup='from __main__ import parse_exp) print t.timeit() That should give you an idea of how long it's actually taking. j -- Joshua Kugler VOC/SigNet Provider (aka Web App Programmer) S&K Aerospace Alaska 1 |