On Tue, Mar 22, 2005 at 10:41:19AM +0100, Steffen Goeldner wrote:
> Attached is a small benchmark script. The test platform is:
> 
> The output looks like:
>   47638 rows

> Finally, let's use the new subroutine approach:
> 
>   my $rows = sub {
>     return if $rs->{EOF};
>     my $row = [ map { $rs->Fields( $_ )->{Value} } 0..4 ];
>     $rs->MoveNext;
>     return $row;
>   };
> 
>   24 wallclock secs (19.83 usr +  0.50 sys = 20.33 CPU)
> 
> Not only that the last approach lead to a much more moderate
> memory utilization, but it also outperforms the other variants
> significantly!

Two sides of the same coin:  Memory allocation is slow.

What you're seeing is the same reason that fetchall_* (and selectall_*)
is often slower than fetchrow_*.

  http://search.cpan.org/src/TIMB/DBI_AdvancedTalk_2004/sld017.htm

Tim.

Reply via email to