> My intuition tells me that the performance gain is not mesureable anyway.

Measurable, but also negligable (code below):

Benchmark: timing 50000 iterations of ref, val...
  ref:  3 wallclock secs ( 2.72 usr +  0.12 sys =  2.84 CPU) @ 17605.63/s (n=50000)
  val:  7 wallclock secs ( 6.05 usr +  0.18 sys =  6.23 CPU) @  8025.68/s (n=50000)

Since each of our servers is handling less than 20 requests per second
(requests of this type, anyways) we wouldn't gain much with this
optimization.  I'm still the type that's always looking for a good
performance tweak, though :)  I will look through the performance
guidelines some more, though I think I've already applied them all :)

Thanks for your input!
Jonathan Field

#---------------------------------------
# Benchmark code (hope my logic here is reasonable):
#---------------------------------------

#!/usr/local/bin/perl
use strict;
use warnings;
use Benchmark;

our $string = "a" x 1024 x 100;    # simulate a 100KB HTML file
open FILE, ">/dev/null" or die $!; # simulate an very fast connection ;)
our $fh = \*FILE;

timethese(50000, {
    'ref' => \&refcpy,
    'val' => \&valcpy,
});

sub refcpy {
    my $ref = \$string;
    print $fh $$ref;
}

sub valcpy {
    my $val = $string;
    print $fh $val;
}



-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to