New submission from Paul Overing <paulover...@gmail.com>:
I have found that using timeout with a python queue.Queue() results in an average delay of 14.5ms in Windows over Ubuntu in python 3.6.5/3.7, I subtracted the 1 ms timeout. I have also tried datetime.datetime.now() to measure the time, with similar results. Does that make sense? import queue import time max=0 min=10000 num = 10000 sum = 0 for x in range(10000): q = queue.Queue() start = time.perf_counter() try: msg = q.get(block=True, timeout=.001) except: end = time.perf_counter() chng = end-start -.001 if chng > max: max = chng if chng < min: min = chng sum = sum + chng print(f"Avg: {sum/num}") print(f"Min: {min}") print(f"Max: {max}") Results: Window 10, Python 3.6.5/3.7 Avg: 0.014549868429997701 Min: 0.001674142000000046 Max: 0.13890251500000284 Ubuntu 16.04, Python 3.6.5/3.7 Avg: 6.275181290839012e-05 Min: 4.89290034456644e-05 Max: 8.690999695681965e-05 ---------- components: Windows messages: 324277 nosy: Gammaguy, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms type: performance versions: Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34535> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com