in reply to Idiomatic optimizations
gives me:#!/usr/bin/perl -w use Benchmark qw(cmpthese); cmpthese (10000000, { single => sub { $foo = 'foo'}, double => sub { $foo = "foo"} });
50% improvement when strings aren't interpolated.[jon@valium jon]$ ./test.pl Benchmark: timing 10000000 iterations of double, single... double: 1 wallclock secs ( 1.91 usr + 0.00 sys = 1.91 CPU) @ 52 +35602.09/s (n=10000000) single: 2 wallclock secs ( 1.25 usr + 0.00 sys = 1.25 CPU) @ 80 +00000.00/s (n=10000000) Rate double single double 5235602/s -- -35% single 8000000/s 53% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Idiomatic optimizations
by sfink (Deacon) on May 01, 2002 at 01:55 UTC | |
by BlueLines (Hermit) on May 01, 2002 at 03:14 UTC | |
by Sifmole (Chaplain) on May 01, 2002 at 12:06 UTC | |
|
Re: Re: Idiomatic optimizations
by samtregar (Abbot) on May 01, 2002 at 03:22 UTC | |
|
Re: Re: Idiomatic optimizations
by belg4mit (Prior) on May 01, 2002 at 03:50 UTC | |
by Juerd (Abbot) on May 01, 2002 at 16:52 UTC | |
by belg4mit (Prior) on May 01, 2002 at 17:00 UTC | |
by Juerd (Abbot) on May 01, 2002 at 19:05 UTC | |
by belg4mit (Prior) on May 01, 2002 at 20:50 UTC | |
|