Simple language benchmarks -- marpa vs handcrafted parser with regexes

56 views
Skip to first unread message

les...@dubiel.pl

unread,
Feb 18, 2019, 3:33:22 AM2/18/19
to marpa parser


I have tested my current perl5 programs against newly created in Marpa. I'm not using XS.
Marpa program runs 3x slower than my old program. In my opinion it is quite good efficiency. 

Here is the log:



Jeffrey Kegler

unread,
Feb 18, 2019, 10:58:37 AM2/18/19
to Marpa Parser Mailing LIst
If it's a contest of Marpa vs. regular expressions, I'm only surprised that it is just 3x. If your grammar parses using regular expressions, regular expressions will always be much faster.

A while ago I wrote a post with a section on "When NOT to use Marpa".  There were 4 cases and grammars that are regular expressions were the 1st one: http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2015/08/fast_handy.html

I assumed when I saw your grammar that it was part of a larger one, one that was not convenient to parse as a regular expression.  An advantage of having done it with Marpa is that you can extend the grammar much more easily -- but if that's not going to be the case in your application, yes, Marpa may well not be the best choice for you.

--
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 marpa-parser...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

les...@dubiel.pl

unread,
Feb 18, 2019, 11:40:09 AM2/18/19
to marpa parser


If it's a contest of Marpa vs. regular expressions, I'm only surprised that it is just 3x. If your grammar parses using regular expressions, regular expressions will always be much faster.

Actually this is not only regular expressions -- I've had to built a bunch of functions that do the same what rules in grammars do -- organize structured data.



A while ago I wrote a post with a section on "When NOT to use Marpa".  There were 4 cases and grammars that are regular expressions were the 1st one: http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2015/08/fast_handy.html

Thanks for hit. I will read this.



 
... your grammar that it was part of a larger one... with Marpa is that you can extend the grammar much more easily

I am delighted that parsing got that simple with such solutions as your's Marpa or Perl6 grammars -- yacc and lex always looked avery wild for me. 


Thank you, greetings from Poland. :)

Jeffrey Kegler

unread,
Feb 18, 2019, 11:44:07 AM2/18/19
to Marpa Parser Mailing LIst
I hope we have helped.  Even if you do go with just regular expressions, perhaps having a BNF arrow in the quiver will be useful for other things.

Reply all
Reply to author
Forward
0 new messages