code: def test_gather_async_optimized(ray_start_regular_shared):
      it = from_range(100)
      it = it.gather_async(batch_ms=100, num_async=4)
      assert sorted(it) == list(range(100))
  
imports: import sys
  import time
  import collections
  from collections import Counter
  import pytest
  import ray
  from ray.util.iter import from_items, from_iterators, from_range, from_actors, ParallelIteratorWorker, LocalIterator
  from ray._private.test_utils import Semaphore
label_desc: Use image node_id 27 for calling a global function with example usage: test_gather_async_optimized(ray_start_regular_shared) without return types