Are you sure this is necessary? I would've presumed count() is cached.