% % timeit % statusdict begin 0 setjobtimeout end /printproc { % executable => - (prints out proc w/o huge array/dict printout) dup type /arraytype ne {load} if ({) print {(% ) printf} forall (\b}\n) print % == } def /timeit { % count test => - 2 copy currenttime 3 1 roll % N test T N test repeat currenttime exch sub % N test dT 1000 mul 2 index div 60 mul 1000 mul round 1000 div % N test ms 3 -1 roll % test ms N (Time: % ms, Loops: %, Test: ) [ 4 -2 roll ] printf printproc } def /test { /a [100 {random 100 mul round} repeat] def 3 {a dup length array copy bubblesort pop} timeit 3 {a dup length array copy /gt heapsort pop} timeit 3 {a dup length array copy /gt quicksort pop} timeit } def test