On Thu, 13 Sep 2001 [EMAIL PROTECTED] wrote:
> I have a minor optimization suggestion. Instead of this:
> unless ($sth_routine_name) {
> #setup statement handle
> }
> Do this:
>
> $sth_routine_name ||= $dbh->prepare(....);
> pretty sure this is more efficient than setting up the unless block.
True, these are about the same, but in order of speed:
$i ||= 1;
$i = 1 unless $i;
$i = $i ? 1 : 0;
All faster than:
unless ( $i) { $i = 0;}
I like your idiom because
$i ||= do { 1 };
is still faster than an unless statement.
My pet micro optimization is ' vs. ", stopping the
C habit of "This is a string", thus taking the string out of
interpolative context. Talk about infinitesimal differences.