Advertisement
Guest User

Timings for speed improvements to deque.rotate()

a guest
Jun 23rd, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.56 KB | None | 0 0
  1. Baseline
  2. --------
  3. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  4. 1000000 loops, best of 3: 0.288 usec per loop
  5. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  6. 1000000 loops, best of 3: 0.284 usec per loop
  7. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  8. 1000000 loops, best of 3: 0.344 usec per loop
  9. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  10. 1000000 loops, best of 3: 0.369 usec per loop
  11. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  12. 1000000 loops, best of 3: 0.373 usec per loop
  13. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  14. 1000000 loops, best of 3: 0.418 usec per loop
  15. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  16. 1000000 loops, best of 3: 0.423 usec per loop
  17. ~/py27 $
  18. ~/py27 $
  19. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  20. 1000000 loops, best of 3: 0.27 usec per loop
  21. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  22. 1000000 loops, best of 3: 0.292 usec per loop
  23. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  24. 1000000 loops, best of 3: 0.367 usec per loop
  25. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  26. 1000000 loops, best of 3: 0.375 usec per loop
  27. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  28. 1000000 loops, best of 3: 0.451 usec per loop
  29. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  30. 1000000 loops, best of 3: 0.46 usec per loop
  31.  
  32. ~/py27 $
  33. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1)"
  34. 1000000 loops, best of 3: 0.297 usec per loop
  35. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1)"
  36. 1000000 loops, best of 3: 0.302 usec per loop
  37. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  38. 1000000 loops, best of 3: 0.424 usec per loop
  39. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  40. 1000000 loops, best of 3: 0.409 usec per loop
  41. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  42. 1000000 loops, best of 3: 0.572 usec per loop
  43. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  44. 1000000 loops, best of 3: 0.588 usec per loop
  45. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  46. 100000 loops, best of 3: 5.73 usec per loop
  47. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  48. 100000 loops, best of 3: 5.72 usec per loop
  49.  
  50. Remove struct indirections
  51. ==========================
  52.  
  53. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  54. 1000000 loops, best of 3: 0.283 usec per loop
  55. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  56. 1000000 loops, best of 3: 0.282 usec per loop
  57. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  58. 1000000 loops, best of 3: 0.367 usec per loop
  59. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  60. 1000000 loops, best of 3: 0.366 usec per loop
  61. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  62. 1000000 loops, best of 3: 0.433 usec per loop
  63. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  64. 1000000 loops, best of 3: 0.435 usec per loop
  65. ~/py27 $
  66. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  67. 1000000 loops, best of 3: 0.289 usec per loop
  68. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  69. 1000000 loops, best of 3: 0.291 usec per loop
  70. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  71. 1000000 loops, best of 3: 0.371 usec per loop
  72. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  73. 1000000 loops, best of 3: 0.366 usec per loop
  74. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  75. 1000000 loops, best of 3: 0.442 usec per loop
  76. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  77. 1000000 loops, best of 3: 0.438 usec per loop
  78.  
  79. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1)"
  80. 1000000 loops, best of 3: 0.287 usec per loop
  81. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1)"
  82. 1000000 loops, best of 3: 0.293 usec per loop
  83. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  84. 1000000 loops, best of 3: 0.42 usec per loop
  85. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  86. 1000000 loops, best of 3: 0.418 usec per loop
  87. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  88. 1000000 loops, best of 3: 0.596 usec per loop
  89. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  90. 1000000 loops, best of 3: 0.599 usec per loop
  91. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  92. 100000 loops, best of 3: 5.68 usec per loop
  93. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  94. 100000 loops, best of 3: 5.68 usec per loop
  95.  
  96. =Replace memcpy=====================================
  97. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  98. 1000000 loops, best of 3: 0.27 usec per loop
  99. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  100. 1000000 loops, best of 3: 0.28 usec per loop
  101. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(1)"
  102. 1000000 loops, best of 3: 0.279 usec per loop
  103. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  104. 1000000 loops, best of 3: 0.32 usec per loop
  105. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(20)"
  106. 1000000 loops, best of 3: 0.317 usec per loop
  107. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  108. 1000000 loops, best of 3: 0.375 usec per loop
  109. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(100))" -s "r=d.rotate" "r(50)"
  110. 1000000 loops, best of 3: 0.375 usec per loop
  111.  
  112. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  113. 1000000 loops, best of 3: 0.289 usec per loop
  114. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(1)"
  115. 1000000 loops, best of 3: 0.294 usec per loop
  116. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  117. 1000000 loops, best of 3: 0.323 usec per loop
  118. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(20)"
  119. 1000000 loops, best of 3: 0.327 usec per loop
  120. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  121. 1000000 loops, best of 3: 0.377 usec per loop
  122. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000))" -s "r=d.rotate" "r(50)"
  123. 1000000 loops, best of 3: 0.377 usec per loop
  124.  
  125.  
  126. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1)"
  127. 1000000 loops, best of 3: 0.288 usec per loop
  128. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  129. 1000000 loops, best of 3: 0.384 usec per loop
  130. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(20)"
  131. 1000000 loops, best of 3: 0.387 usec per loop
  132. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  133. 1000000 loops, best of 3: 0.562 usec per loop
  134. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(50)"
  135. 1000000 loops, best of 3: 0.569 usec per loop
  136. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  137. 100000 loops, best of 3: 5.47 usec per loop
  138. ~/py27 $ py27 -m timeit -s "from collections import deque" -s "d=deque(range(1000000))" -s "r=d.rotate" "r(1000)"
  139. 100000 loops, best of 3: 5.47 usec per loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement