in reply to Re: Re: Re: Re: Re: Idiomatic optimizations
in thread Idiomatic optimizations

The system was idle, trust me, nothing happening. And no, no evals on my part. I simply cut and paste the benchmarking code used by BlueLines HOWEVER, scrutinizing the Benchmark code reveals that *it* in fact string evals.

--
perl -pew "s/\b;([mnst])/'$1/g"

Replies are listed 'Best First'.
Re: Re6: Idiomatic optimizations
by Juerd (Abbot) on May 01, 2002 at 21:03 UTC

    HOWEVER, scrutinizing the Benchmark code reveals that *it* in fact string evals.

    I don't see how it can possibly get something useful out of a sub reference's stringification, but I'm too lazy to look at Benchmark's source. Let's try something different:

    #!/usr/bin/perl -w use Benchmark qw(cmpthese); sub single { $foo = 'foo' } sub double { $foo = "foo" } cmpthese (10000000, { single => sub { single() }, double => sub { double() } });
    What does that show on your system?

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      It yields a negligible difference 1-3% which I would attribute to system noise. Interestingly(?) it takes much no longer to run, or at least reports more wallclock seconds (15-19 vs 2 or 3 of the other (although it was obviously longer than that)).

      --
      perl -pew "s/\b;([mnst])/'$1/g"