[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: Benchmarking (was Re: [FWP] words words words)



On Fri, May 19, 2000 at 02:26:50PM -0500, tayers@bridge.com wrote:

>     steve => sub {
>       open T, "threes";
>       chomp(@t = <T>);
>       undef $/;
        ^^^^^^^^

This undefs $/ for the whole program.  That's probably what's throwing off
the benchmark results for all the code blocks.  Replace undef with local
and see what happens.

Also note that steve() and tim(), because they use the global variables @t
and %t and don't clear them between uses, never have to reallocate that
memory after the first iteration.  They just assign the same-sized list
into memory that's already allocated.

When Benchmarking code, it's vitally important to make sure no changes leak
between iterations, or even worse between code blocks.


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe