[Dbix-class] Performance Issue

Alexander Hartmaier alexander.hartmaier at t-systems.at
Tue Feb 21 08:49:16 GMT 2012


So loading more modules takes longer than loading less modules, how does th=
at surprise you?
The actual query takes almost the same time taking rounding errors into con=
sideration.
How are you planning to use DBIC that startup and connection time is an iss=
ue for you?

Am 2012-02-20 23:04, schrieb Bill McCormick:
Bill McCormick wrote, On 2/20/2012 10:30 AM:
I just wrote a tiny little script, just using DBI and DBD::SQLite, and ther=
e is no delay.

#!/usr/bin/perl

use strict;

use DBI;
use DBD::SQLite;


my $recipes_sql =3D q/SELECT * FROM recipe/;

my $dbfile=3D"/home/fiber/data/recipe.db3";

my $dbh =3D DBI->connect("dbi:SQLite:$dbfile") or croak $DBI::errstr;

my $recipe_ary_ref  =3D $dbh->selectall_arrayref($recipes_sql,{ Slice =3D> =
{} });

foreach my $recipe ( @$recipe_ary_ref ) {
    print qq/$recipe->{ID} $recipe->{NAME}\n/;
}


Thanks!!

Alexander Hartmaier wrote, On 2/20/2012 10:02 AM:

Are you sure you measure correctly?
Did you include Perl startup time by accident?

Am 2012-02-20 16:09, schrieb Bill McCormick:


I'm just getting started using DBIx::Class and I am a little surprised
at performance (rather, lack there of).

Perhaps I've missed some key point, index or other such thing, but it
takes well over a second to get results on a single table that has
very few records (<20).

I am running on Debian Squeeze (Linux 2.6.33 i586) with perl (v5.10.1)
and SQLite3 (3.7.3).

If I export DBIC_TRACE=3D1 and then run the my script, I see this:

    SELECT me.ID, me.NAME FROM recipe me:

So then if I run that query in sqlite3, it is markedly faster. I
understand that the DBIx::Class needs a little more time, this delay
makes me think I must have missed something.




I added some metrics. There is a HUGE (~1.5 sec) difference that needs to b=
e accounted for here. Either I'm doing something very wrong (very likely) o=
r there is something very wrong with DBIx.

Each test starts with this:
BEGIN {
    print qq/***** Start Test *****\n/;
    $start =3D clock();
    print qq/Start: $start\n/;
}

The part that takes the longest is loading the DBIx::Schema compared to loa=
ding DBI & DBD, but even the DB connect an query takes longer.

use MyApp::Schema;

$tick =3D clock();
$ticktock =3D $tick - $start;
print qq/Load Use: $ticktock\n/;

compared to:
use DBI;
use DBD::SQLite;

$tick =3D clock();
$ticktock =3D $tick - $start;
print qq/Load Use: $ticktock\n/;

I appreciate any insight at all.

Thanks!!

Output here:
$:/home/fiber/www/cgi-bin# ./recipe-test-DBIx.pl;./recipe-test-DBI.pl
***** Start Test *****
Start: 0.08
Load Use: 1.12
Connect: 1.32
Query: 1.65
RECIPE 1
RECIPE 2
RECIPE 3
RECIPE 4
RECIPE 5
RECIPE 6
RECIPE 7
RECIPE 8
RECIPE 9
RECIPE 10
RECIPE 11
RECIPE 12
RECIPE 13
RECIPE 14
RECIPE 15
RECIPE 16
RECIPE 17
RECIPE 18
RECIPE 19
Complete: 1.66
***** Start Test *****
Start: 0.08
Load Use: 0.17
Connect: 0.18
Query: 0.19
1 RECIPE 1
2 RECIPE 2
3 RECIPE 3
4 RECIPE 4
5 RECIPE 5
6 RECIPE 6
7 RECIPE 7
8 RECIPE 8
9 RECIPE 9
10 RECIPE 10
11 RECIPE 11
12 RECIPE 12
13 RECIPE 13
14 RECIPE 14
15 RECIPE 15
16 RECIPE 16
17 RECIPE 17
18 RECIPE 18
19 RECIPE 19
Complete: 0.19





_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co=
.uk


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
Notice: This e-mail contains information that is confidential and may be pr=
ivileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*=
"*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120221/3d6=
952dd/attachment-0001.htm


More information about the DBIx-Class mailing list