mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
tests/bench: Add testcase to compare bytes(N) vs b"\0" * N.
Based on python-dev discussion regarding PEP467.
This commit is contained in:
7
tests/bench/bytealloc-1-bytes_n.py
Normal file
7
tests/bench/bytealloc-1-bytes_n.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import bench
|
||||
|
||||
def test(num):
|
||||
for i in iter(range(num // 1000)):
|
||||
bytes(10000)
|
||||
|
||||
bench.run(test)
|
||||
7
tests/bench/bytealloc-2-repeat.py
Normal file
7
tests/bench/bytealloc-2-repeat.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import bench
|
||||
|
||||
def test(num):
|
||||
for i in iter(range(num // 1000)):
|
||||
b"\0" * 10000
|
||||
|
||||
bench.run(test)
|
||||
Reference in New Issue
Block a user