The difference between BC and DBC is the method-call overhead. If you really want to squeze out nonoseconds per call, it matters. It is not something I would propagate in use though:

Create table 5000 x 12 Dbindcol 660153.156 recs/sec 4.8 x faster DBC bindcol 633472.697 recs/sec 4.6 x faster BC Darrayref 563380.282 recs/sec 4.1 x faster DAR arrayref 525486.075 recs/sec 3.8 x faster AR array 227086.929 recs/sec 1.7 x faster A hashref 136836.344 recs/sec HR
{ $sth->execute; my ($n, $now) = (0, [ gettimeofday ]); while (my $ref = $sth->fetchrow_hashref) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("hashref", $n, $now); } { $sth->execute; my ($n, $now) = (0, [ gettimeofday ]); while (my @row = $sth->fetchrow_array) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("array", $n, $now); } { $sth->execute; my ($n, $now) = (0, [ gettimeofday ]); while (my $ref = $sth->fetchrow_arrayref) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("arrayref", $n, $now); } { $sth->execute; my ($n, $now) = (0, [ gettimeofday ]); while (my $ref = DBI::st::fetchrow_arrayref ($sth)) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("Darrayref", $n, $now); } my %ref; { $sth->execute; $sth->bind_columns (\(@ref{@{$sth->{NAME_lc}}})); my ($n, $now) = (0, [ gettimeofday ]); while ($sth->fetch) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("bindcol", $n, $now); } { $sth->execute; $sth->bind_columns (\(@ref{@{$sth->{NAME_lc}}})); my ($n, $now) = (0, [ gettimeofday ]); while (DBI::st::fetchrow_arrayref ($sth)) { ++$n % 100 == 0 and printf " %6d\r", $n; } report ("Dbindcol", $n, $now); }

Enjoy, Have FUN! H.Merijn

In reply to Re^4: DBI Style Inquiry by Tux
in thread DBI Style Inquiry by edict

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.