speedup count method