Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Thursday January 13, 2005
02:58 PM

Parse::RecDescent efficiency

[ #22701 ]

When I bundle up the rules for the file format parser I've designed into one big superrule representing the entire file and run the parser, it takes 5 minutes. When I skip that top-level rule and instead write a small program to call the rules that rule included, using appropriate control logic to call the right parsing at the right time, it takes 23 seconds.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • P::RD slowly eats away at the string. This is notoriously inefficient for large strings. A "future version" was planned that used pos() instead of nibbling, but that never happened.
    --
    • Randal L. Schwartz
    • Stonehenge
    • Thanks for the info. I'm parsing a gigantically large string, so that explains it.

      Do you know if the Perl6::Rules module would give me any better performance?

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • Built my own hand-crafted recursive-descent parser and I can now parse the file in under 2 seconds. Converting my grammar to code was fun; maybe I should get a job as a recursive descent parser compiler. ;)

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers