From 3943634fa6654de45ce830cb9fe272f4cc5a49b5 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 26 Oct 2018 09:32:09 +0100 Subject: [PATCH] tests: import bench/large_messages.py. --- tests/bench/large_messages.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/bench/large_messages.py diff --git a/tests/bench/large_messages.py b/tests/bench/large_messages.py new file mode 100644 index 00000000..24220023 --- /dev/null +++ b/tests/bench/large_messages.py @@ -0,0 +1,28 @@ + +# Verify _receive_one() quadratic behaviour fixed. + +import subprocess +import time +import socket +import mitogen + + +@mitogen.main() +def main(router): + c = router.fork() + + n = 1048576 * 127 + s = ' ' * n + print('bytes in %.2fMiB string...' % (n/1048576.0),) + + t0 = time.time() + for x in range(10): + tt0 = time.time() + assert n == c.call(len, s) + print('took %dms' % (1000 * (time.time() - tt0),)) + t1 = time.time() + print('total %dms / %dms avg / %.2fMiB/sec' % ( + 1000 * (t1 - t0), + (1000 * (t1 - t0)) / (x + 1), + ((n * (x + 1)) / (t1 - t0)) / 1048576.0, + ))