slightly faster way to count features