response time problem.

Mukund
Fri, 21 Mar 2008 08:32:28 -0000

About your application''s environment
Ruby version              1.8.6 (x86_64-linux)
RubyGems version          1.0.1
Rails version             2.0.2
Active Record version     2.0.2
Action Pack version       2.0.2
Active Resource version   2.0.2
Action Mailer version     2.0.2
Active Support version    2.0.2
Application root          ...
Environment               development
Database adapter          mysql
Database schema version   23

The controller passes @selectedLandmarkList and @availLandmarkList to
the view which populates a couple of selection lists with the same.
The problem occurs when I have about 8900 items in each list.

Rendering template within layouts/admin
Rendering data_entry/add_waypoint
Rendered data_entry/_waypoint_landmark_table (0.35038)
Rendered data_entry/_waypoint_form (0.42428)
Rendered layouts/_admin_menu (0.00458)
Completed in 198.55079 (0 reqs/sec) | Rendering: 0.43816 (0%) | DB:
0.07019 (0%) | 200 OK [http://localhost/data_entry/add_waypoint]


I can eliminate the error by not populating one of the lists in which
case the response is as below.

Rendering template within layouts/admin
Rendering data_entry/add_waypoint
Rendered data_entry/_waypoint_landmark_table (0.12888)
Rendered data_entry/_waypoint_form (0.13201)
Rendered layouts/_admin_menu (0.00488)
Completed in 0.70847 (1 reqs/sec) | Rendering: 0.22962 (32%) | DB:
0.06943 (9%) | 200 OK [http://localhost/data_entry/add_waypoint]

My question is how can things break by just addition of another 8900
items to another list item?  Is this a defect?   I haven''t noticed
this problem when I was on 1.2.6.

The code snippet in the controller that is different for both cases is
something like this

  if params[:selectedLandmark].length > 50
        flash[:notice]="...."
--->         params[:selectedLandmark].each { |itr|
          @selectedLandmarkList += @availLandmarkList.select{ |v|
(v[1].to_s==itr)? true : false }
        }
      else ....

If I get rid of the iterator which basically doesn''t do much, the
response time is fast as the second list is empty. I don''t understand
why it is slow in the first case.