On Thu, 18 May 2000, brian moseley wrote:
> On Thu, 18 May 2000, Jeffrey W. Baker wrote:
>
> > .= concatenation is way faster
>
> i don't have any results to back up my claim. therefore,
> my words are eaten :)
>
> i was convinced tho, even way back before you came to cp. i
> wonder what convinced me!
that was probably me :) but, i don't recall suggesting join.
but i do recall pushing away from concat when print()-ing, this benchmark
also illustrates why i made Apache::print dereference references to
strings. 5.005_03 does seem todo better with the array benchmark than
5.006, oh well. there's tradeoffs both ways, i don't think there's a
clear winner.
Benchmark: timing 30000 iterations of array, concat, ref_array...
array: 8 wallclock secs ( 6.90 usr + 0.27 sys = 7.17 CPU) @4184.10/s (n=30000)
concat: 7 wallclock secs ( 5.98 usr + 0.16 sys = 6.14 CPU) @4885.99/s (n=30000)
ref_array: 5 wallclock secs ( 4.59 usr + 0.16 sys = 4.75 CPU) @6315.79/s (n=30000)
use Benchmark;
open my $fh, ">/dev/null" or die;
my($one, $two, $three) = map { $_ x 4096 } 'a'..'c';
timethese(30_000, {
'ref_array' => sub {
my @a;
push @a, \($one, $two, $three);
my_print(@a);
},
'array' => sub {
my @a;
push @a, $one, $two, $three;
my_print(@a);
},
'concat' => sub {
my $s;
$s .= $one;
$s .= $two;
$s .= $three;
my_print($s);
},
});
sub my_print {
for (@_) {
print $fh ref($_) ? $$_ : $_;
}
}
- New Module (was Re: RFC: Apache::R... Francesc Guasch
- Re: RFC: Apache::Request::Forms (o... Autarch
- Re: RFC: Apache::Request::Forms (o... Drew Taylor
- Re: RFC: Apache::Request::Forms (or something similar) Autarch
- Re: RFC: Apache::Request::Forms (or something simil... brian moseley
- Re: RFC: Apache::Request::Forms (or something s... Drew Taylor
- Re: RFC: Apache::Request::Forms (or something s... Jeffrey W. Baker
- Re: RFC: Apache::Request::Forms (or somethi... brian moseley
- Re: RFC: Apache::Request::Forms (or som... Gunther Birznieks
- Re: RFC: Apache::Request::Forms (o... Doug MacEachern
- Re: RFC: Apache::Request::Forms (or som... Doug MacEachern
- Re: RFC: Apache::Request::Forms (o... brian moseley
- Re: RFC: Apache::Request::Forms (or somethi... w trillich
- Re: RFC: Apache::Request::Forms (or something simil... Doug MacEachern
- Re: RFC: Apache::Request::Forms (or something s... Autarch
- Re: RFC: Apache::Request::Forms (or somethi... Doug MacEachern
- Re: RFC: Apache::Request::Forms (or som... Matt Sergeant
- Re: RFC: Apache::Request::Forms (o... Vivek Khera
- Re: RFC: Apache::Request::Forms (o... Doug MacEachern
- Re: RFC: Apache::Request::Forms (o... Matt Sergeant
- Re: RFC: Apache::Request::Forms (o... Doug MacEachern
