Perl 5 Porters Weekly: October 15-October 21, 2012
[ crossposted from its original blog ]
Welcome to Perl 5 Porters Weekly, a summary of the email traffic of the perl5-porters email list. Let's get to this week's topics.
- Perl 5.17.5 is now available
- Timely destruction guarantees
- COW status
- perl5db refactoring
- hash assignment fixes and speedup are ready for review
- Pull request CPAN-1.99_51
- sub signatures status and performance
- No-taint support in Perl
Perl 5.17.5 is now available
Florian Ragwitz announced that Perl 5.17.5 was released to a CPAN mirror near you.
Timely destruction guarantees
Leon Timmermans writes that many Perl developers have relied on Perl's destruction behavior even if no explicit guarantees have been documented, citing for example autoclosing of filehandles. Leon urges the p5p team to think about this question, especially if Perl moves toward a true garbage collection paradigm rather than a refcount system.
Many responders in this thread think through some of the ramifications of garbage collection in the context of Perl, questioning if a GC + Perl is even still Perl.
COW status
Father Chrysostomos reports that he's managed to get his COW-branch passing core tests except for one. He wants to do more benchmarking and cleanup work.
perl5db refactoring
Shlomi Fish updates progess on his perl5db grant and asks for ideas for inspiration on other features for Perl's debugger. Rocky Bernstein offered several suggestions, and it sounds like one Shlomi may persue is splitting perl5db into more than one file so that the command / REPL interface is seperated from the core API.
hash assignment fixes and speedup are ready for review
Ruslan Zakirov finished the hash assignment work noted in the last p5p summary and submitted it for review. He includes a summary list of changes, and several benchmarks for comparison with current behavior.
Pull request CPAN-1.99_51
Andreas Koenig requested that CPAN-1.99_51 be merged into blead because VMS support has reached a point of usefulness. This should enable the CPANPLUS removal work to proceed. (For context, see previous summaries, starting here.)
sub signatures status and performance
Peter Martini checks in again with an update on subroutine signatures, giving the current status and some performance benchmarks.
Here's what the current implementation does:
sub foo($bar,$baz){} initializes $bar and $baz to the first and second
parameter passed to the function, or undef if there was none.
sub foo($bar,@bar){} does the same, but slurps the second and all remaining
parameters into @bar.
sub foo($bar,%baz){} slurps the second and all remaing parameters into
%baz, in the same manner as my ($bar,%baz) = @_ would
sub foo($bar) : proto($) {} assigns the $ prototype to the sub
B::Deparse has been updated to display the signatures, and the signatures
plus prototype if a sub has both.
*** a literal @_ in a sub with a named parameter will die during compilation
*** a glob that references @_ will die at runtime (I added a 'poison' magic
that will croak on an array access to *main::_)
*** &foo; will die if foo has a sub signature. I added this since &foo
without parens references the calling subs @_, and I kind of punted on the
question for now. I suppose treating it as foo(@_) (as long as the calling
sub is allowed to reference @_) is completely legitimate, but it seemed a
very grey area to me...
*** goto into a sub with a signature croaks at runtime
And here are some benchmarks:
*Two lexical variables, and actual copies:*
dumbbench -p 0.005 -- ./perl -e 'sub foo{my ($foo,$bar) = @_;}
foo("blah","blah") for 1 .. 1_000_000'
cmd: Ran 20 iterations (0 outliers).
cmd: Rounded run time per iteration: 9.591e-01 +/- 3.1e-03 (0.3%)
*Two lexical variables, and actual copies:*
dumbbench -p 0.005 -- ./perl -Ilib -Mfeature=experimental::sub_signature -e
'sub foo($foo,$bar){} foo("blah","blah") for 1 .. 1_000_000'
cmd: Ran 23 iterations (3 outliers).
cmd: Rounded run time per iteration: 7.5809e-01 +/- 9.4e-04 (0.1%)
You can see there's a savings of about 20% using the signatures.
No-taint support in Perl
Steffen Mueller proposed his no-taint support changes be incorporated into blead. This is a set of compiler flags that completely disable taint-checking and provides a modest, but measurable performance boost. Dave Mitchell replied that he hopes to look at this in a few weeks.