From 17db09650569609793061e83aded7039e39e81a7 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 19 Jun 2014 21:44:33 +0300 Subject: bench: Add tests for constructing various containers from iterator. Both "bound" (like, length known) and "unbound" (length unknown) are tested. All of list, tuple, bytes, bytesarray offer approximately the same performance, with "unbound" case being 30 times slower. --- tests/bench/from_iter-6-bytes_unbound.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/bench/from_iter-6-bytes_unbound.py (limited to 'tests/bench/from_iter-6-bytes_unbound.py') diff --git a/tests/bench/from_iter-6-bytes_unbound.py b/tests/bench/from_iter-6-bytes_unbound.py new file mode 100644 index 0000000000..20aa556277 --- /dev/null +++ b/tests/bench/from_iter-6-bytes_unbound.py @@ -0,0 +1,8 @@ +import bench + +def test(num): + for i in iter(range(num//10000)): + l = [0] * 1000 + l2 = bytes(map(lambda x: x, l)) + +bench.run(test) -- cgit v1.2.3