Advertisement
Guest User

Untitled

a guest
May 30th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # coding:utf-8
  2.  
  3. from benchmarker import Benchmarker
  4. import random
  5. import sort
  6.  
  7.  
  8. def initdata():
  9. data = range(100)
  10. random.shuffle(data)
  11. return data
  12.  
  13. loop = 1000
  14. with Benchmarker(loop, width=20) as bench:
  15.  
  16. @bench('default')
  17. def default_sort(bm):
  18. for i in bm:
  19. initdata().sort()
  20.  
  21. @bench('insertion')
  22. def insertion(bm):
  23. for i in bm:
  24. sort.insertion_sort(initdata())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement