Skip to content

Instantly share code, notes, and snippets.

@ThomasParistech
Created July 20, 2022 12:59
Show Gist options
  • Select an option

  • Save ThomasParistech/b7e8301710fe7e5ef6b1612b6e0d78a1 to your computer and use it in GitHub Desktop.

Select an option

Save ThomasParistech/b7e8301710fe7e5ef6b1612b6e0d78a1 to your computer and use it in GitHub Desktop.
def _profiled_batch_func(process_func: Callable[..., None],
list_kwargs: List[KwargsType],
shared_kwargs: KwargsType) -> List[Tuple[float, float]]:
"""Process and profile a batch"""
profiling_events: List[Tuple[float, float]] = []
for kwargs in list_kwargs:
start_time = time.perf_counter()
process_func(**kwargs, **shared_kwargs)
end_time = time.perf_counter()
profiling_events.append((start_time, end_time))
return profiling_events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment