I'm not surprised that it takes more time. I am, however, surprised that it takes more than 0.5 sec. That fact that it takes more than 1.0 sec really has me scratching my head. I was hoping to run this with tt2 in a cgi web application on an a small system (running Squeeze) that's closer to an embedded device than a server class machine or even a desktop system. I'm using thttpd and SQLite as well, since they are lightweight and have small footprints.

Speed *is* an issue, however, I need to keep things as lightweight as possible. So the number of module dependencies is also an issue, especially if I won't be needing them. So, for example, when I install DBIx::Class::Schema::Loader ... and it depends on some Lingua modules ... which depend on some Text::German and Snowball::Swedish modules ... I think I'm looking at a lot of bloat. I only have a 2G flash drive to work with, and I need to save as much of that as possible for data storage.

If I cannot resolve these issues, then I don't think I should use DBIx::Class.

There really won't be more than a handful of web pages on this system, so using only Perl with the CGI module won't be so horrible.

Thanks!!

Alexander Hartmaier wrote, On 2/21/2012 2:49 AM:
So loading more modules takes longer than loading less modules, how does that surprise you? The actual query takes almost the same time taking rounding errors into consideration. How are you planning to use DBIC that startup and connection time is an issue 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 there is no delay.

#!/usr/bin/perl

use strict;

use DBI;
use DBD::SQLite;


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

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

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

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

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=1 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 be accounted for here. Either I'm doing something very wrong (very likely) or there is something very wrong with DBIx.

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

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

use MyApp::Schema;

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

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

$tick = clock();
$ticktock = $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/[email protected]


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
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 privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*


_______________________________________________
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/[email protected]

_______________________________________________
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/[email protected]

Reply via email to