diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-19 21:44:33 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-19 21:44:33 +0300 |
commit | 17db09650569609793061e83aded7039e39e81a7 (patch) | |
tree | f5a65542b7b301784f7e4ed5618199453c0e69d2 /tests/bench/from_iter-6-bytes_unbound.py | |
parent | e53d2197e4a749b2e2265c7b42f9b9834128799f (diff) | |
download | micropython-17db09650569609793061e83aded7039e39e81a7.tar.gz micropython-17db09650569609793061e83aded7039e39e81a7.zip |
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.
Diffstat (limited to 'tests/bench/from_iter-6-bytes_unbound.py')
-rw-r--r-- | tests/bench/from_iter-6-bytes_unbound.py | 8 |
1 files changed, 8 insertions, 0 deletions
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) |