Contribute to Perl by completing quests on Questhub

Initially launched as Play Perl, Questhub is now a general place where groups of people can share their tasks as quests, and vote on quests to encourage each other. Play Perl is now the Perl realm on Questhub.

Contributing to Perl and the Perl community was never so easy. Last week Questhub gained support for stencils: pre-scripted quests with clear instructions, and bonus points. The perl realm now has an initial set of stencils, each of which defines a specific way you can contribute to Perl, CPAN or the Perl Foundation. Some of these only require a few minutes, some require a larger commitment of your time.

Flux: new streaming data processing framework

Flux is the framework I've been meaning to release for a very long time [1].

What's it good for? Message queues; organizing your data processing scripts in a scalable way; de-coupling your processing pipeline elements, making them reusable and testable; seeing your system as a collection of lego-like blocks which can be combined and replaced as you like. With Flux, your code is a series of tubes.

Flux is a rewrite of Stream framework which we wrote and used in Yandex for many years. Stream:: namespace on CPAN is taken, though, which gave me the reason to do a cleanup before uploading it, as well as a chance to rewrite everything with Moo/Moose.

I'm planning to release Flux in small chunks, explaining them along the way in separate blog posts, as time will allow. Today, I'll explain the main ideas behind it, some core classes, and how all its parts are working together.

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

Basically, you pay for each function you import, once per function instance, in each module, again and again. That's different from, for example, Moose, where 99% of importing performance hit is on first use, when perl compiles all the code, and then each subsequent import() is almost free. Due to this, if your app has many modules, autodie can easily become the biggest bottleneck in its starting performance.

So, it's a bad idea to add use autodie qw(:all) thoughtlessly to your boilerplate, in addition to use strict; use warnings; use 5.0xx;. If you do need to use autodie, it might be a good idea to explicitly list all functions you want to replace.

PS: I don't know why it should be that way. I know autodie 2.18 does more caching and is significantly faster than previous versions, but it still doesn't cache much, apparently.

PPS: This post was brought to you by questhub, as usual :)

/usr/local/bin rant

So, imagine you're a CentOS user, and you want to install a CPAN module into the system. Let's say you want to install cpanm.

You get the root shell with sudo -s.
You enter: cpan App-cpanminus.
And then you enter: cpanm --help... and oops:

[root@localhost vagrant]# cpanm --help
bash: cpanm: command not found


Play Perl is a Startup

I'm leaving my daily job at Yandex in 2 months to see how far I can take the concepts behind

I spent 7 years at Yandex, it's pretty much the only job I ever had.
I never participated in any startups.
I have no idea what I'm doing :)
But I really want to try.

Here are the slides I showed at meetup today:
(I'm not sure how comprehensible they are without the talk, though.)

What this means for the Play Perl future:

  • Source code stays open (for now; I'm not making any promises, but don't see reasons to close it either.)
  • Service stays free. (I have several ideas about monetization. None of them include ads or require payments for the current functionality. And I promise none of them are evil.)
  • I have a big incentive to take this beyond the Perl community, to the other open source communities, at least. Maybe to non-programmer communities too. I'm planning to do this as soon as possible.

In the meantime, it's been 1.5 months since my last post, so here are some new features Play Perl got:

  • tags!
  • comment likes;
  • reward circle, displaying the number of points you're going to get on quest accomplishment;
  • "quest completed" modal box;
  • lots of frontend optimizations and other minor improvements.