Bug 24488: perf - move patrons_count out of the loop