optimize time by iterating write count