Site performance improvement

Hi,

I have a question, on how to further improve the site. I attached the profiler of the site.

Currently, It take about 1.8 seconds to load.

At first I have question on 1. "Mysql#get_length" which take the longest to run. What this means? is the query time to get data from database? or the time to process data from database?

http://railsmanual.com/class/Mysql/get_length

2. "Integer#times" => what this one mean

It's the times method on Integer. 3.times { puts "Ho"} will output Ho Ho Ho Do you have the native mysql gem installed? it looks like you're not; that will hurt you.

Fred

Frederick Cheung wrote: > Do you have the native mysql gem installed? it looks like you're not; > that will hurt you.

> Fred

Excellent idea. Now the speed improve from 2 second to .5 seconds.

My next step is to even optimize it. This time, I don't have slowdown in mysql access anymore

Well it's hard to guess without seeing any code, but the fact that AR::Base#== is being called so many times is suspicious. I'd guess that you're eager-loading multiple associations. I'd cut back on those a bit - eager loading is handy but it can sometimes hurt more than it helps (especially multiple has_manys - you end up getting a full cartesian product back from the db that rails has to chomp through).

Fred