bpo-35884: Add missing FIFO queue benchmark (GH-11898)
https://bugs.python.org/issue35884
This commit is contained in:
parent
e182318e6a
commit
43766f82dd
|
@ -214,6 +214,15 @@ def deque_append_pop(trials=trials, a=deque([1])):
|
||||||
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
|
||||||
|
def deque_append_popleft(trials=trials, a=deque([1])):
|
||||||
|
ap, pop = a.append, a.popleft
|
||||||
|
for t in trials:
|
||||||
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop(); ap(1); pop();
|
||||||
|
|
||||||
def write_list(trials=trials, a=[1]):
|
def write_list(trials=trials, a=[1]):
|
||||||
for t in trials:
|
for t in trials:
|
||||||
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
|
a[0]=1; a[0]=1; a[0]=1; a[0]=1; a[0]=1
|
||||||
|
@ -261,7 +270,7 @@ if __name__=='__main__':
|
||||||
'\nData structure write access:',
|
'\nData structure write access:',
|
||||||
write_list, write_deque, write_dict,
|
write_list, write_deque, write_dict,
|
||||||
'\nStack (or queue) operations:',
|
'\nStack (or queue) operations:',
|
||||||
list_append_pop, deque_append_pop,
|
list_append_pop, deque_append_pop, deque_append_popleft,
|
||||||
'\nTiming loop overhead:',
|
'\nTiming loop overhead:',
|
||||||
loop_overhead]:
|
loop_overhead]:
|
||||||
if isinstance(f, str):
|
if isinstance(f, str):
|
||||||
|
|
Loading…
Reference in New Issue