[Python-checkins] bpo-35884: Add missing FIFO queue benchmark (GH-11898)

Miss Islington (bot) webhook-mailer at python.org
Sat Feb 16 15:51:07 EST 2019


https://github.com/python/cpython/commit/43766f82ddec84fad7a321eeec2e1cbff6ee44d2
commit: 43766f82ddec84fad7a321eeec2e1cbff6ee44d2
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2019-02-16T12:51:02-08:00
summary:

 bpo-35884: Add missing FIFO queue benchmark (GH-11898)



https://bugs.python.org/issue35884

files:
M Tools/scripts/var_access_benchmark.py

diff --git a/Tools/scripts/var_access_benchmark.py b/Tools/scripts/var_access_benchmark.py
index f8490457e65a..44cb200da7a7 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 @@ def loop_overhead(trials=trials):
             '\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):



More information about the Python-checkins mailing list