summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-02-16 20:51:02 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-02-16 20:51:02 (GMT)
commit43766f82ddec84fad7a321eeec2e1cbff6ee44d2 (patch)
tree5db94c3b6143123b38e8f222f959b1dea061a7e4 /Tools
parente182318e6a473e6e9341f1aab8e49f2b1035c674 (diff)
downloadcpython-43766f82ddec84fad7a321eeec2e1cbff6ee44d2.zip
cpython-43766f82ddec84fad7a321eeec2e1cbff6ee44d2.tar.gz
cpython-43766f82ddec84fad7a321eeec2e1cbff6ee44d2.tar.bz2
bpo-35884: Add missing FIFO queue benchmark (GH-11898)
https://bugs.python.org/issue35884
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/var_access_benchmark.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Tools/scripts/var_access_benchmark.py b/Tools/scripts/var_access_benchmark.py
index f849045..44cb200 100644
--- a/Tools/scripts/var_access_benchmark.py
+++ b/Tools/scripts/var_access_benchmark.py
@@ -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();
+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]):
for t in trials:
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:',
write_list, write_deque, write_dict,
'\nStack (or queue) operations:',
- list_append_pop, deque_append_pop,
+ list_append_pop, deque_append_pop, deque_append_popleft,
'\nTiming loop overhead:',
loop_overhead]:
if isinstance(f, str):