Peter Scott wrote:
On Sat, 27 Aug 2005 14:07:09 +0300, Octavian Rasnita wrote:
What do you think, if the most important is the speed, which method is
recommended to get the results of a DBI query?

fetchrow_arrayref
or
fetchrow_array

(I guess that fetchrow_hashref has the lowest speed).


That wasn't one of your choices.

Don't guess, measure.  perldoc Benchmark.


Peters right. Measure it. And I would love to know your findings. But you probably need to include the database (pgsql, mysql, oracle...) because of the different backends.

Be careful that your first SQL doesn't become cached giving you artificially fast returns on subsequent queries. In Oracle I typically can run a SQL statement in say 3 seconds and run it again right away and get 0.2 seconds. But you'll see that on the first two runs.

One thing that Perl has a lot of (and doesn't get enough coverage) are the tools for development. Benchmark, Test::More, Devel::Size, Devel::Cover, Data::Dumper -- these are all wonderful tools at your disposal and well worth spending some serious time learning how to use.

As an anectdote, my brother has fallen in favor with Python while I'm a Perl fan. Tools like this are either unavailable or unknown to him (I honestly don't know which). In either case it's apparent that he has a lot of work to do in validating and testing code that I don't have to experience.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to