2 # python python_pybuf_runme3.py benchmark
3 #for the benchmark, other wise the test case will be run
6 if len(sys.argv)>=2 and sys.argv[1]=="benchmark":
9 k=1000000 #number of times to excute the functions
12 a = bytearray(b'hello world')
15 print("Time used by bytearray:",time.time()-t)
21 print("Time used by string:",time.time()-t)
28 assert buf1 == b'a'*10
31 assert buf2.startswith(b"Hello world!\x00")
33 count = pybuf.func3(buf2)
34 assert count==10 #number of alpha and number in 'Hello world!'
36 length = pybuf.func4(buf2)
39 buf3 = bytearray(b"hello")