◐ Shell
clean mode source ↗

Message 402440 - Python tracker

bench.py: measure the shortest possible sleep. Use time.sleep(1e-10): 0.1 nanosecond. It should be rounded to the resolution of the used sleep function, like 1 ns on Linux.

On Linux with Fedora 34 Python 3.10 executable, I get:

    Mean +- std dev: 60.5 us +- 12.9 us (80783 values)

On Windows with a Python 3.11 debug build, I get:

    Mean +- std dev: 21.9 ms +- 7.8 ms (228 values)

Sadly, it seems like on Windows 10, one of the following function still uses the infamous 15.6 ms resolution:

* CreateWaitableTimerW()
* SetWaitableTimer()
* WaitForMultipleObjects()