Performance patch to Parse-Yapp 1.05

C

Clint Olsen

Hi:

In the generated code, Yapp places in the entire yystate and yyrules array
references directly in the call. For my application, which calls the
Parser thousands of times on a grammar that is almost 1000 lines, the
overhead to recreate this data structure each time dominates the run time.
Intuition says that moving this to a file-scoped lexical or global in the
package should mean that overhead is only paid once, and it does. For me,
this change results in almost a 4x speed improvement.

-Clint

--- lib/Parse/Yapp/Output.pm Sun Feb 11 07:29:25 2001
+++ Output.pm Sun Feb 8 00:30:59 2004
@@ -53,16 +53,18 @@

<<$head>>

+my $yystates = <<$states>>;
+
+my $yyrules = <<$rules>>;
+
sub new {
my($class)=shift;
ref($class)
and $class=ref($class);

my($self)=$class->SUPER::new( yyversion => '<<$version>>',
- yystates =>
-<<$states>>,
- yyrules =>
-<<$rules>>,
+ yystates => $yystates,
+ yyrules => $yyrules,
@_);
bless($self,$class);
}
 
J

John M. Gamble

Hi:

In the generated code, Yapp places in the entire yystate and yyrules array
references directly in the call. For my application, which calls the
Parser thousands of times on a grammar that is almost 1000 lines, the
overhead to recreate this data structure each time dominates the run time.
Intuition says that moving this to a file-scoped lexical or global in the
package should mean that overhead is only paid once, and it does. For me,
this change results in almost a 4x speed improvement.

Maybe to ensure that the patch actually gets implemented, you
could post this to a modules group, and cc the author of the module?
 
C

Clint Olsen

Maybe to ensure that the patch actually gets implemented, you could post
this to a modules group, and cc the author of the module?

Thanks for the suggestion.

I've sent questions to the author over the past couple months and didn't
hear squat, so I can only assume that he's either not maintaining or not
interested in answering questions about it.

-Clint
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top