http://www.perlmonks.org?node_id=55103

I've noticed that despite Perl's mostly undeserved reputation as just another "inefficient" interpreted scripting language, most good Perl developers (and especially those who frequent Perlmonks ;), are quite concerned with their code's performance, and often benchmark isolated snippets of code in order to find out how efficiently Perl performs a given algorithm/function, or to catch a glimpse of whether or not Perl internally optimizes some particular syntax. Credit for this is due in no small part to the inclusion of the Benchmark module in the standard Perl distribution, which makes comparing and benchmarking Perl code a relatively trivial, non-tedious, and even fun task.

Perl users, especially beginners, are often surprised at how well Perl optimizes things, and that they don't have to code in round-about ways (as is the case in many other interpreted/scripting languages) to speed up their programs. And, from time to time, people are surprised that an operation which is seemingly efficient is actually dog-slow under Perl (eg. returning multiple elements per map call).

I have, of late, been running many general-interest benchmarks on this and that, and have actually come to the point where I'm naming my benchmark scripts, organizing them by keywords, and providing little blurbs as to what I learned from each benchmark. For example:

# keywords: method sub call overhead # learned: OO-style method invocation is only about 13% slower than d +irect invocation (v5.6) package Foo; use strict; use warnings; use Benchmark qw(cmpthese); sub new { bless {}, shift; } sub meth { my ($self, $val) = @_; $val; } my $obj = new Foo; my @params = (42, 1, 2, { a=> 'silly hashref'}, 'a string'); cmpthese (-3, { method => sub { $obj->meth(@params); }, direct => sub { meth($obj, @params); } });
The point I'm trying to make is not regarding this particular benchmark (although it is edifying to know that method invocation doesn't have very much overhead), but regarding the usefulness of such information for the Perl community as a whole. I have noticed that a substantial portion of SoPW nodes relate to the issue of performance and have some sort of benchmarking in them, often of general interest.

So, I've been contemplating the idea of a "Benchmark Arena", where people could submit categorized benchmarks, and discuss specific performance-related issues. A Benchmark Arena could serve as a communinal repository of information regarding optimal ways of doing such-and-such under Perl, like a Q&A section, but devoted specifically to the issue of code performance. Because Perl offers so-many-WTDI, it is very enlightening to see several WTDI in action, and see how they compare against each other. The benchmark arena would ideally be keyword-searchable, so for example, the benchmark above could be found under the "method", "sub", "call", and "overhead" keywords, while benchmarks regarding map performance would be found by searching for "map", etc. Keyword categorization would allow much greater specificity of search results than would be possible with a plain-text search.

I believe something like this would serve as a very valuable resource to the Perl community at large, and would be ideal for Perlmonks. What have my fellow monks to say about this idea?