Speed up counting referenced objects.