in reply to Idiomatic optimizations
If you really want to nitpick, try using single quotes instead of double quotes around static text:
BlueLines
Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.
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% --
BlueLines
Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.
In Section
Meditations