Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
>>> @logging_time("ms")
... def calculate_sum_ms(n):
... """Calculate sum of 0 to n-1"""
... return sum(range(n))
...
... @logging_time("s")
... def calculate_sum_s(n):
... """Calculate sum of 0 to n-1"""
... return sum(range(n))
...
>>> calculate_sum_ms(100000)
Calling calculate_sum_ms: 1.87230 ms
>>> calculate_sum_s(100000)
Calling calculate_sum_s: 0.00191 s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment