Performance patch to Parse-Yapp 1.05

Discussion in 'Perl Misc' started by Clint Olsen, Feb 9, 2004.

  1. Clint Olsen

    Clint Olsen Guest

    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);
    }
     
    Clint Olsen, Feb 9, 2004
    #1
    1. Advertising

  2. In article <slrnc2eebt.6nq.clint@poly.0lsen.net>,
    Clint Olsen <> wrote:
    >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?

    --
    -john

    February 28 1997: Last day libraries could order catalogue cards
    from the Library of Congress.
     
    John M. Gamble, Feb 11, 2004
    #2
    1. Advertising

  3. Clint Olsen

    Clint Olsen Guest

    On 2004-02-11, John M. Gamble <> wrote:
    >
    > 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
     
    Clint Olsen, Feb 11, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    19
    Views:
    1,137
    Daniel Vallstrom
    Mar 15, 2005
  2. George Sakkis
    Replies:
    3
    Views:
    370
  3. 7stud --

    optparse: parse v. parse! ??

    7stud --, Feb 20, 2008, in forum: Ruby
    Replies:
    3
    Views:
    190
    7stud --
    Feb 20, 2008
  4. Clint Olsen
    Replies:
    5
    Views:
    149
    Clint Olsen
    Feb 9, 2004
  5. Casiano
    Replies:
    0
    Views:
    108
    Casiano
    Jan 30, 2007
Loading...

Share This Page