Less obtuse list.append() benchmark
This commit is contained in:
parent
75e0ec9e54
commit
cd25ada161
@ -1,11 +1,10 @@
|
||||
from timeit import timeit
|
||||
|
||||
let l = []
|
||||
let add = l.append
|
||||
let pop = l.pop
|
||||
if True:
|
||||
let l = []
|
||||
|
||||
def func():
|
||||
add(1)
|
||||
pop()
|
||||
def func():
|
||||
l.append(1)
|
||||
l.pop()
|
||||
|
||||
print(min(timeit(func,number=100000) for x in range(10)), "list append")
|
||||
print(min(timeit(func,number=100000) for x in range(10)), "list append")
|
||||
|
@ -1,11 +1,10 @@
|
||||
from fasttimer import timeit
|
||||
|
||||
l = []
|
||||
add = l.append
|
||||
pop = l.pop
|
||||
if True:
|
||||
l = []
|
||||
|
||||
def func():
|
||||
add(1)
|
||||
pop()
|
||||
def func():
|
||||
l.append(1)
|
||||
l.pop()
|
||||
|
||||
print(min(timeit(func,number=100000) for x in range(10)), "list append")
|
||||
print(min(timeit(func,number=100000) for x in range(10)), "list append")
|
||||
|
Loading…
Reference in New Issue
Block a user