Skip to content

Commit e918fc5

Browse files
committed
tests/bench: Add testcase to compare bytes(N) vs b"\0" * N.
Based on python-dev discussion regarding PEP467.
1 parent bba77a2 commit e918fc5

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

tests/bench/bytealloc-1-bytes_n.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import bench
2+
3+
def test(num):
4+
for i in iter(range(num // 1000)):
5+
bytes(10000)
6+
7+
bench.run(test)

tests/bench/bytealloc-2-repeat.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import bench
2+
3+
def test(num):
4+
for i in iter(range(num // 1000)):
5+
b"\0" * 10000
6+
7+
bench.run(test)

0 commit comments

Comments
 (0)