From 3836c6a22023011fa6028aeef6607cab4f7de3f4 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 4 Nov 2018 19:43:52 +0000 Subject: [PATCH] tests/bench: run roundtrip.py a ton more to reduce variance --- tests/bench/roundtrip.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/bench/roundtrip.py b/tests/bench/roundtrip.py index 7c5a9252..33b3c5b8 100644 --- a/tests/bench/roundtrip.py +++ b/tests/bench/roundtrip.py @@ -5,13 +5,22 @@ Measure latency of local RPC. import mitogen import time +import ansible_mitogen.process +ansible_mitogen.process.setup_gil() + +try: + xrange +except NameError: + xrange = range + def do_nothing(): pass @mitogen.main() def main(router): f = router.fork() + f.call(do_nothing) t0 = time.time() - for x in range(1000): + for x in xrange(20000): f.call(do_nothing) - print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec' + print('++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec')