I just uploaded version 0.52 of Parse::Gnaw to CPAN.

The changes from the version I showed at the mongers meeting last year
include changing "some" and "any" to be thrifty instead of greedy and to
change "g" and "t" to "greedy" and "thrifty". Then updating all the tests
and the slideshow to match these changes.

The other thing I added was a benchmark script. The idea was to compare
parsing speeds between Parse::Gnaw and Parse::RecDescent.

The script does a: use Benchmark qw(:all) ;
then calls:
cmpthese( -5, {
        parse_recdescent_1 => \&prd_test_1,
        parse_recdescent_few => \&prd_test_few,
        parse_recdescent_many => \&prd_test_many,
        parse_gnaw_1 => \&pg_test_1,
        parse_gnaw_few => \&pg_test_few,
        parse_gnaw_many => \&pg_test_many,
} );

Both Parse::Gnaw and Parse::RecDescent use precompiled parsers so they
aren't part of the benchmarking process. The grammar is a simple grammar
to parse dates like "Fri Jan 17". And each parser is called with three
different numbers of dates, 1, 6, and 60.  (1, few, many). Benchmark runs
each one for 5 seconds.

When you run the script, the output looks something like this:

benchmarking for 30 seconds...
                        Rate
parse_recdescent_many   19/s
parse_gnaw_many         64/s
parse_recdescent_few   270/s
parse_gnaw_few         523/s
parse_recdescent_1     819/s
parse_gnaw_1          1127/s

There's more text on each line showing percentages, but the Rate is all I
really care about.

If I'm reading it right, and I'm not sure I am, then the script says that
Parse::Gnaw runs about three times faster than Parse::RecDescent (64 calls
per second versus 19 calls per second). That is really surprising to me.

Either that, or "Rate" means something else, and Parse::Gnaw is three
times slower than Parse::RecDescent. That would be something that would be
much less surprising.

Anyone more familiar with the Benchmark.pm module and its output? Is
"Rate" showing calls per second or something else?

Either way, the latest Parse::Gnaw is up on CPAN as rev 0.52

Greg







_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to