make use of time.clock_gettime_ns()
It is faster and without floating point. Just time.clock_gettime_ns() // 1000000 to get milliseconds.
@socketpair Feel free to create a pull-request 😄
This is a good idea. I’m not sure if it’s really meaningfully faster, but it does make sense to use an integer API when we want an integer. One caveat is that clock_gettime_ns is UNIX-only, while time_ns is portable, and should be just as good except that the former has the ability to specify a non-default clock. I’ll submit a PR to change the default-initialization method as suggested here.
IS faster: https://github.com/python/cpython/issues/111482