Guest User

Untitled

a guest
Oct 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. threads = []
  2. 1.times do |i|
  3. threads << Thread.new do
  4. b = Benchmark.measure do
  5. code.call
  6. end
  7. puts b
  8. end
  9. end
  10. threads.each {|t| t.join }
  11.  
  12. yields
  13.  
  14. 1.470000 0.220000 1.690000 ( 1.894148)
  15.  
  16.  
  17. threads = []
  18. 5.times do |i|
  19. threads << Thread.new do
  20. b = Benchmark.measure do
  21. code.call
  22. end
  23. puts b
  24. end
  25. end
  26. threads.each {|t| t.join }
  27.  
  28. yields
  29.  
  30. 1.830000 0.270000 2.100000 ( 5.176225)
  31. 9.690000 1.240000 10.930000 ( 17.328003)
  32. 9.730000 1.250000 10.980000 ( 17.394973)
  33. 10.090000 1.270000 11.360000 ( 18.084461)
  34. 10.150000 1.290000 11.440000 ( 18.221553)
Add Comment
Please, Sign In to add comment