Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Best way to do caching of Class::DBI objects from a MySQL database

by eXile (Priest)
on May 01, 2005 at 23:13 UTC ( [id://453085]=note: print w/replies, xml ) Need Help??


in reply to Best way to do caching of Class::DBI objects from a MySQL database

OK, thanks all for your answers. Profiling/looking at performance is indeed something that had to be done in this case, and I know of several places where I can improve my code, but not without a lot of effort, and ugly hacks. Right now my code is quite tidy, and has a nice layering (class-dbi modules/API so other users can use my database too without a lot of hassle, and a cgi-layer that uses template toolkit to generate HTML), and I'd like to keep it maintainable like that.

I've profiled some, a typical result of dprofpp -r is below. Seems my main problem is the SQL part of this, so either I have to be smarter in my queries (or smarter in how I let Class::DBI make queries) or ... cache?!

Total Elapsed Time = 19.73262 Seconds Real Time = 19.73262 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 17.9 3.532 3.532 2933 0.0012 0.0012 DBI::st::execute 15.4 3.041 3.041 119885 0.0000 0.0000 Class::Accessor::get 13.2 2.610 26.949 126519 0.0000 0.0002 Class::Accessor::__ANON__ 8.38 1.654 1.721 49101 0.0000 0.0000 Class::Data::Inheritable: +:__ANON__ 8.18 1.614 5.405 8107 0.0002 0.0007 Class::DBI::_init 7.31 1.443 6.437 106803 0.0000 0.0001 Class::DBI::Column::name_ +lc 6.80 1.342 1.342 2931 0.0005 0.0005 DBI::db::ping 6.37 1.256 1.667 13440 0.0001 0.0001 Class::DBI::_attribute_st +ore 6.05 1.193 2.621 2890 0.0004 0.0009 Class::DBI::transform_sql 5.78 1.140 7.540 106149 0.0000 0.0001 Class::DBI::Column::__ANO +N__ 5.38 1.061 9.354 16177 0.0001 0.0006 Class::DBI::Relationship: +:HasA::__ ANON__ 4.49 0.886 24.001 2730 0.0003 0.0088 Class::DBI::_flesh 4.41 0.871 1.783 16893 0.0001 0.0001 Class::DBI::_attrs 3.04 0.599 4.327 2932 0.0002 0.0015 DBIx::ContextualFetch::st +::_untain t_execute 3.01 0.593 26.163 5980 0.0001 0.0044 Class::DBI::get 2.94 0.581 1.187 19511 0.0000 0.0001 Class::DBI::ColumnGrouper +::group_c ols 2.69 0.530 1.367 14215 0.0000 0.0001 Class::DBI::_attribute_ex +ists 2.64 0.520 1.085 16533 0.0000 0.0001 Class::DBI::ColumnGrouper +::primary 2.37 0.467 0.467 10984 0.0000 0.0000 Class::DBI::Column::group +s 2.36 0.466 4.993 5822 0.0001 0.0009 Ima::DBI::__ANON__ 2.27 0.447 10.095 5472 0.0001 0.0018 Class::Trigger::call_trig +ger 2.09 0.412 2.102 16345 0.0000 0.0001 Class::DBI::primary_colum +n 1.89 0.372 1.013 5460 0.0001 0.0002 Class::DBI::ColumnGrouper +::_uniq 1.76 0.347 1.108 5527 0.0001 0.0002 Class::DBI::meta_info 1.62 0.320 0.319 11 0.0291 0.0290 Template::Parser::BEGIN 1.56 0.308 0.308 12454 0.0000 0.0000 DBI::common::FETCH 1.51 0.298 4.476 2730 0.0001 0.0016 DBIx::ContextualFetch::st +::select_ row 1.37 0.270 1.193 6075 0.0000 0.0002 Class::DBI::_find_columns 1.27 0.250 0.310 3070 0.0001 0.0001 DBIx::ContextualFetch::st +::fetch 1.23 0.242 0.730 103 0.0023 0.0071 base::import
  • Comment on Re: Best way to do caching of Class::DBI objects from a MySQL database
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://453085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found