Yes (still guessing), the discard events are likely to be a major part of
the cost.

But don't take my guesses too seriously -- measurement may show something
different.

On Tue, Nov 21, 2017 at 6:27 AM, Michael Dorman <[email protected]> wrote:

> Hey, Jeffrey,
>
>
>
> So just to confirm, generating an event (thus requiring processing and
> $recce->resume()) is part of this cost, yes?
>
>
>
> Michael Dorman
>
>
>
> *From:* [email protected] [mailto:marpa-parser@
> googlegroups.com] *On Behalf Of *Jeffrey Kegler
> *Sent:* Monday, November 20, 2017 5:09 PM
> *To:* Marpa Parser Mailing LIst <[email protected]>
> *Subject:* Re: Are there good strategies for diagnosing performance
> issues?
>
>
>
> I'm very rusty at looking at profiles of Marpa::R2, but I hope some
> off-the-top-of-my-head remarks might be useful.  Typically, almost all the
> time of an R2 parse is taken up by the Perl layer, and by the semantics --
> the parse itself is almost free.  So looking at how you handle the
> semantics may help.  In particular, the fewer Perl callbacks you use, the
> faster you are likely to run.
>
>
>
> Marpa::R3, when it's fully developed, will allow more of the semantics to
> be done inside Marpa itself, without callbacks, and should be faster.
>
>
>
> On Mon, Nov 20, 2017 at 1:52 PM, <[email protected]> wrote:
>
> Hey, all,
>
>
>
> I’ve been hoping for some time to replace an existing parser---implemented
> using YAPP and a custom lexer---with a parser implemented using Marpa::R2.
>
>
>
> After a moderate amount of work, I finally got a working parser.
>
>
>
> The grammar is far easier to understand and work with than the old YAPP
> parser; because we’re dealing with an indentation based format, I do have
> to use a discard event to track indentation depths and emit indentation
> tokens and the like.
>
>
>
> However, it’s disappointingly slow, taking about twice as long to parse
> our full set of files.  That was *really* unexpected.
>
>
>
> Immediately suspecting my code, I cranked my pathological case through
> Devel::NYTProf; imagine my surprise when the top entry in the list of ‘top
> 15 subroutines’ was an xsub: Marpa::R2::Thin::V::stack_step
> <https://groups.google.com/forum/parser-1-line.html#Marpa__R2__Thin__V__stack_step>.
> And this wasn’t by a small amount: that routine took 556s out of 590s or
> so, and the next most expensive routine is Marpa::R2::Thin::SLR::read at
> 12.7s.  These completely dominated the total runtime.
>
>
>
> While I will try to sanitize my parser and make it postable so people can
> perhaps point out problems, I thought I might first just ask: is that sort
> of high cost in stack_step generally representative of some sort of problem
> in the grammar?  Is there some well-known construct that leads to a blow-up
> that is easily eliminated, etc.?  Is there something I could log or examine
> that might shed some light?
>
>
>
> Any guidance would be appreciated.
>
>
>
> Michael Dorman
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
> ------------------------------
> This email message is for the sole use of the intended recipient(s) and
> may contain confidential information.  Any unauthorized review, use,
> disclosure or distribution is prohibited.  If you are not the intended
> recipient, please contact the sender by reply email and destroy all copies
> of the original message.
> ------------------------------
>
> --
> You received this message because you are subscribed to the Google Groups
> "marpa parser" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to