learningequality/ka-lite — pull request #497 by rtibbles (2013-08-17 00:35:19+00:00)
Title: Coach reports efficiency

Efficiency changes for Coach Report API.

Exercise and Video Logs are now queried from the database in a single query for each. Specific values are plucked in order to generate a dictionary in memory, that can be manipulated without additional database requests.

Running using the debug_toolbar tools, the following stats were measured on my local system before and after:
Before: Total Time: Approx 5000ms, SQL 196 queries in 2750ms.
After: Total Time: Approx 300ms, SQL 8 queries in 15ms.

Result: Nearly 17x speed increase in querying coach reports.

Would be interested in the order comparison between these two methods.

Still needs more testing to check timeline reports.