Performance improvement ideas...
1) Make sure you don't have 10 years worth of data to loop through-fewer docs means better performance...
2) If your view has the time entry field and the date field dispayed, then you can use viewcolumnentry classes to get that data rather than setting the doc and referencing fields.
3) Write a scheduld agent that runs nightly to loop through the docs and compute the totals. It would store these in a new document. With the totals already populated there, the user interface need only pull in the totals without any looping.