Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. |oc pivot copies array time fullGCs incGCs |
  2. oc := OrderedCollection new: 1000.
  3. pivot := oc capacity // 2 +1.
  4. oc resetTo: pivot.
  5. pivot to: 2 by: -1 do: [:i | oc addFirst: i].
  6.  
  7. copies := 10000.
  8. array := Array new: copies.
  9. 1 to: copies do: [:i | array at: i put: oc copy].
  10. oc addFirst: 1.
  11. fullGCs := Smalltalk vmParameterAt: 7.
  12. incGCs := Smalltalk vmParameterAt: 9.
  13. TimeProfileBrowser onBlock: [time := [1 to: copies do: [:i | (array at: i) addFirst: i]]
  14. timeToRun.].
  15. fullGCs := (Smalltalk vmParameterAt: 7) - fullGCs.
  16. incGCs := (Smalltalk vmParameterAt: 9) - incGCs.
  17. {time . fullGCs. incGCs}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement