[perl #132306] [PERF] parameters, even if unused, make stuff slower ( f1($a, $, $, $, $, $) vs f2($a, $b, $c, $d, $e, $f) ) <[email protected]>

[email protected] ("Aleks-Daniel Jakimenko-Aleksejev via RT")
Newsgroups perl.perl6.compiler
Message-ID <[email protected]>
Yes, it would be awesome to have warnings for unused params and variables.


On 2018-01-14 12:16:08, [email protected] wrote:
> On Sat, 14 Oct 2017 20:53:03 -0700, [email protected] wrote:
> > FWIW I made a throwaway script that looks for unused params, and
> > there
> > are many
> > of these in rakudo sources. Of course, most of these cases are not in
> > hot
> > paths, but the overall performance benefit may be very noticeable.
> >
> > There are also cases like this:
> > https://github.com/rakudo/rakudo/blob/nom/src/core/IO/Socket/Async.pm#L313-
> > L315
> > where named arg is present in the signature but does absolutely
> > nothing (or so
> > it seems?).
> >
> > Dunno if I should post the results. There are many false-positives
> > and
> > I guess
> > many cases are not caught at all, so a proper approach is needed if
> > we
> > really
> > want to replace all these with $.
>
> Wouldn't a warning about unused variables be more appropriate
> than silently rewriting them to `$`? Their names can be introspected
> and used for
> something by they user. We actually do do that in core (sub MAIN USAGE
> generation).
>
> That Proc::Async line you point out actually has a bug in it and a
> warning would've detected it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.