Marpa v. Parse::RecDescent: a rematch

[ This is cross-posted from the Ocean of Awareness blog. ]

The application

In a recent post, I looked at an unusual language which serializes arrays and strings, using a mixture of counts and parentheses. Here is an example:

A2(A2(S3(Hey)S13(Hello, World!))S5(Ciao!))

The language is of special interest for comparison against recursive descent because, while simple, it requires procedural parsing -- a purely declarative BNF approach will not work. So it's a chance to find out if Marpa can play the game that is recursive descent's specialty.

The previous post focused on how to use Marpa to mix procedural and declarative parsing together smoothly, from a coding point of view. It only hinted at another aspect: speed. Over the last year, Marpa has greatly improved its speed for this kind of application. The latest release of Marpa::R2 now clocks in almost 100 times faster than Parse::RecDescent for long inputs.

The benchmark

Post Every Day

A couple years ago I ran a conference called YAPC, and I challenged myself to write a blog post every single day for a year about that conference. It annoyed a few people, but it taught me a valuable lesson about marketing…that daily touch point is important. If you run a blog, a Facebook page, or a Twitter account, you should attempt to post something to it every day. It makes it more interesting for the people that follow you. It keeps them coming back. And if you’re super busy like me, feel free to queue up some posts so that you don’t have to actually be there every day. 

[From my blog.]

Perl 5 Porters Weekly: June 10-16, 2013

Welcome to Perl 5 Porters Weekly, a summary of the email traffic of the perl5-porters email list.

Topics this week include:

  • [PATCH] use dots - allow '.' instead of '->' everywhere and concat with '~'
  • NWCLARK TPF grant April report
  • I made t/podcheck.t less sensitive and fixed various pod issues
  • perl needs safer implicit close
  • An observation: Short- vs. long-term benefits
  • [PATCH] Add an API to attach a signature string to a CV
  • Perl experiments

SelfLoader and things I've learned writing/using a debugger

A decade in CPAN toolchain

Dave Cross:

I’m not going to object to Module::Build leaving the core. I’m sure there are good reasons, I just wish I knew what they are. I am, however, slightly disappointed to find that Schwern was wrong ten years ago and that ExtUtils::MakeMaker wasn’t doomed.

Schwern wasn’t wrong and MakeMaker remains doomed all these years later. It’s still around only because there hasn’t been anything to take its place. Module::Build looked like it was going to be that usurper – but didn’t work out.

LacunaWax

image

Jonathan Barton made this super cool new client for the Lacuna Expanse, that allows you to automate a lot of functions in the game, to make massive empire management easier. 

Don't copy "use autodie" in every module

You pay a constant price in your app's starting performance for each time you use autodie;.

Here's a quick benchmark:

$ time perl -E 'say "package X$_; use autodie qw(:all);" for 1..100;' | perl

real	0m1.482s
user	0m1.431s
sys	0m0.047s

Compare with Moose:

$ time perl -E 'say "package X$_; use Moose;" for 1..100;' | perl

real	0m0.343s
user	0m0.328s
sys	0m0.016s

It doesn't get much better without qw(:all):

$ time perl -E 'say "package X$_; use autodie;" for 1..100;' | perl

real	0m1.212s
user	0m1.169s
sys	0m0.047s

But it gets significantly better if you import only a small number of functions:

$ time perl -E 'say "package X$_; use autodie qw(open close);" for 1..100;' | perl

real	0m0.175s
user	0m0.166s
sys	0m0.011s

I'm back!

Fast forward to mid 2013. I last wrote about some checksum one-liner, and it was also pretty much among the last few Perl things I did that year before getting distracted by $WORK (again.)

Now is the time to change that ;)

Video Encoding Modules?

I'm putting the final touches on UAV::Pilot v0.3, which will have a better event-driven API and support control through Joysticks and (maybe) Wiimotes.

This brings me to the point on the ROADMAP I've been dreading: handling the video stream. The Parrot AR.Drone v2 sends an h.264 stream over the network. I can save this to a file easily enough, I suppose, but decoding and displaying the stream in real-time (probably to an SDL window) seems like an obvious thing to want to do.

However, the only CPAN module I've found for any kind of video encoding is FFmpeg, and it only supports reading from a file or URI, not an open network stream.

Does anybody know of another option out there? I can write the bindings to a C library myself, but I'd prefer to avoid it.

Stop Talking About Perl

I couldn’t agree more with Genehack’s “Stop Talking About Perl” talk at YAPC this past week. We spend so much time venting hot air. That’s not going to attract new users. Instead, we need to build cool stuff. Whether you’re into building cool new ecosystems like Moose, Dist::Zillla, and Plack, or if you’re into building cool new apps like Lacuna and The Game Crafter, building cool stuff and talking about that is the way to get people excited about your language. 

Actions beat words every single time. 

[From my blog.]

New And Improved: Bloomd::Client

cross-posted from dams blog

New And Improved: Bloomd::Client

New and Improved!

thanks to @yenzie for the picture :P

Mistake in Chapter 7. References ( Page : 233 )

Sir,
In the free document for beginners, http://www.perl.org/books/beginning-perl/.. There is a mistake in chess game program at declaration part (not related to perl but Chess).

i.e in Chapter 7. References ( Page : 233 )

Now it is,
my @back = qw(R N B Q K N B R);
But it has to be,
my @back = qw(R N B Q K B N R);

That is : Chess pieces must be placed like mirror image for pieces R, N and B..

Left side : R N B
Right side: B N R

Chicago.PM New Website! New Meetup URL! New Presentations Project!

Lots of news for the Chicago.PM group! We've got a new Chicago.PM website, powered by Github, up at http://chicago.pm.org. The website is completely editable via Github using the Octopress system. We hope to start sharing resources about Perl on our website, increasing the exposure of the good tutorials and learning sites.

Slideshow: Graphviz and Friends

Last night I gave a talk to the Melbourne Perl Mongers, on AT&T's Graphviz, and the Perl wrappers available, specifically including Marpa.

It's not really complete with a voice-over, but it might encourage people to investigate further.

Cheers

A little nicer way to use smartmatch on perl 5.18

5998623964_f1a4023855_n.jpg

Of course as Perl developers we all love new features, don't we?

So the moment we could work with perl 5.10 we all started using smartmatch, right? If not for the only reason it allows us to write elegant code like this:

use v5.10.1;
@array = qw ( Thom Jonny Colin Ed Phil );
say "I found Phil!" if 'Phil' ~~ @array;

But now we have perl 5.18 and some of the ideas of smartmatch turned out to be a little too smart, and so we now consider it an experimental feature. So even code like this, when executed on a 5.18 perl, gives warnings:

Smartmatch is experimental at smart.pl line 3.
I found Phil!

Reducing Freshman "Flunk-Outs" in Purdue Engineering Classes

The Purdue Mechanics Freeform Classroom, introduced by Charles Krousgrill, implements a set of changes in the early Mechanical Engineering classes to reduce "freshman flunk-outs". Especially in Purdue Engineering programs, there are many classes with large numbers of students (80+) in their freshman and sophomore year. Because of these class sizes, getting the personal attention many freshmen (and some sophomores) need is difficult -- adding the interactive textbook (a "lecturebook"), comment-enabled course blog, and instructional videos as the Purdue Mechanics Freeform Classroom has done reduces the D-F-W (withdraw) rate to 5% from 20%, thereby turning the C-D-F-W students into B students.. (Alas, the number of A students stays the same-- but the C-D-F-W rate is now 1 in 20 rather than 1 in 5.)

This is a substantial improvement to early Engineering education, well worth taking a look at.

Pinto Users, Please Stand Up!

A local company has been experimenting with Pinto for a couple weeks and they asked me to come chat with them. So I met some of their developers yesterday and we talked about how Pinto might improve their build process. The conversation was great and we learned a lot from each other.

But when they asked me "who uses Pinto?" I didn't have a good answer. I can show them all the forks on GitHub, or tell them how many times getpinto.stratopan.com has been hit, or list all the crowdfunding contributors, but none of that really answers their question.

Just Build Something

A lot of people think that there is some magic to starting your own business. There’s not. Just make something cool, and sell it. Then you’re in business. Also, don’t worry about getting all your paperwork ducks in a row before you start to create your product. Build your product and then determine if it’s worthy of a business. Just build something already. Why are you still reading this? Get to work.

[From my blog.]

Announcing Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter

The subject Perl-Critic policy is an alternate implementation of the core policy Variables::ProhibitUnusedVariables. My implementation attempts to do a more thorough job of finding unused variables.

The details of the policy can be found at Perl-Critic-Policy-Variables-ProhibitUnusedVarsStricter. My purpose here is more to discuss why the policy exists in the form it does.

My Virtual YAPC::NA 2013

Last year I had the joy of experiencing my first YAPC, it was YAPC::NA in Madison, WI, which is just up the road from me in Chicago. Sadly this year YAPC::NA was much further away and I, having recently defended my Ph.D. thesis, could not afford the time nor cost to attend. While people (most notably Peter Rabbitson (aka riba, aka ribasushi)) offered to help me attend (he with the excess of his own funding drive), finding a job was of greater concern.

That said, I ended up having a great YAPC::NA. I have to extend massive thank the conference organizers for again providing streaming video of the conference talks. I was able to watch an incredible number of talks, learning many new things and seeing many Perlers who I have only known by name (several of whom were not at last year’s YAPC::NA). I even got two shout-outs from speakers!! (squee)

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.