I have a Rails app with a page that is a kind of “infographic” / statistics page. It currently takes ages to load and display.
The main part is a table with a row for each year and then 8 columns. Each cell value has to be calculated by calling methods on the model for that particular year.
Further down the page I am just pulling out certain stats and displaying values.
I’m mainly asking for the table part explained above. My idea for optimising is to create a new model called YearStats and each attribute will be a statistic that I need calculating. Each instance of the model can be a year. I can then do all the calculation when items are added to my app and then just pull those values out when my infographic page is requested.
What I would like to know is, does this sound like the most efficient method of optimising this page?