-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
First, thank you for this great project!
However, I fear, that there is some issue with the time measurement. Using time.get_clock_info() we can get this information:
>>> time.get_clock_info("time")
namespace(implementation='clock_gettime(CLOCK_REALTIME)', monotonic=False, adjustable=True, resolution=1e-09)
>>> time.get_clock_info("perf_counter")
namespace(implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, adjustable=False, resolution=1e-09)time.time()and thereforetime.time_ns()make no claim for being monotonic, meaning that it is possible that a later reading returns a lower number.- The resolution may vary, up to only being 16 milliseconds, as reported in this Stack Overflow post.
Note: This is platform dependent, in this case run in Python 3.11.5 on Linux 6.5.6-arch2-1.
I would suggest switching time.time_ns() with time.perf_counter_ns() as is usually done for reliable performance measurements.
There is a PR open fixing this at #5.
Metadata
Metadata
Assignees
Labels
No labels