Re: [Pyparsing] Painfully slow parsing.
Brought to you by:
ptmcg
From: Gre7g L. <haf...@ya...> - 2009-08-29 00:44:15
|
Try: import pyparsing as PP PP.ParserElement.enablePackrat() It's on the website somewhere, but not nearly prominent enough IMHO. Gre7g ________________________________ From: John Krukoff <jkr...@lt...> To: pyp...@li... Sent: Friday, August 28, 2009 5:08:39 PM Subject: [Pyparsing] Painfully slow parsing. Hello, I have a serious speed problem with a parser written using pyparsing, where it's taking ~13 minutes to parse a 30 line file. I'm totally lost on what might be causing it, as small variations seem to be causing large differences in parsing time. I was hoping I could get some tips on general optimization strategies to follow. For instance, I'm suspicious that I should be trying harder to use the '-' operator, and wonder if that would help... I've posted my project on google code for easy access, the relevant bit that defines the parsing grammar if I can interest someone in taking a look, is at: http://code.google.com/p/compactxml/source/browse/compactxml/expand.py I'm making heavy use of significant whitespace and pyparsing.indentedBlock, so it does feel like I'm fighting against pyparsing a bit. Unfortunately, it looks like indentedBlock is incompatible with packrat parsing, so the most obvious performance improving tip looks to be unusable. I'm also unsure if the mailing list is the best place to ask for help, as it looks like there's more traffic on the pyparsing home page discussion tab? -- John Krukoff <jkr...@lt...> Land Title Guarantee Company ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Pyparsing-users mailing list Pyp...@li... https://lists.sourceforge.net/lists/listinfo/pyparsing-users |