Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding:utf-8
- from benchmarker import Benchmarker
- import random
- import sort
- def initdata():
- data = range(100)
- random.shuffle(data)
- return data
- loop = 1000
- with Benchmarker(loop, width=20) as bench:
- @bench('default')
- def default_sort(bm):
- for i in bm:
- initdata().sort()
- @bench('insertion')
- def insertion(bm):
- for i in bm:
- sort.insertion_sort(initdata())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement