Permalink
Browse files

tests/bench: Add testcase to compare bytes(N) vs b"\0" * N.

Based on python-dev discussion regarding PEP467.
  • Loading branch information...
1 parent bba77a2 commit e918fc5e37c72d864dc369e9b9112dfa21537667 @pfalcon pfalcon committed Jun 8, 2016
Showing with 14 additions and 0 deletions.
  1. +7 −0 tests/bench/bytealloc-1-bytes_n.py
  2. +7 −0 tests/bench/bytealloc-2-repeat.py
@@ -0,0 +1,7 @@
+import bench
+
+def test(num):
+ for i in iter(range(num // 1000)):
+ bytes(10000)
+
+bench.run(test)
@@ -0,0 +1,7 @@
+import bench
+
+def test(num):
+ for i in iter(range(num // 1000)):
+ b"\0" * 10000
+
+bench.run(test)

0 comments on commit e918fc5

Please sign in to comment.