Improve stat generation performance.\nFollow-up fix for bug#9339.