Tag: 页面加载时间

使用Excel数据库缓慢加载页面

我正在使用一个包含大约1600行和4列的Excel电子表格来填充数据库,以便在Ruby应用程序中显示。 这导致页面加载时间超过20秒。 我该如何改善performance? 从db \ seeds.rb: oo = Excelx.new("RatingsDB.xlsx") oo.default_sheet = oo.sheets.first 2.upto(oo.last_row) do |line| Rating.create(name: oo.cell(line,'B'), score: oo.cell(line,'C'), when_rated: oo.cell(line,'A'), comment: oo.cell(line,'D')) end 从app \ controllers \ ratings_controller.rb: def index @ratings_by_name = Rating.paginate(:order => 'name ASC', :page => params[:page], :per_page =>10, :conditions => ['name like ?', "%#{params[:search]}%"]) @ratings_by_score = Rating.paginate(:order => 'score DESC', :page […]