Permalink
Browse files

sync stdout instead of multiple flushes

  • Loading branch information...
geemus committed Dec 8, 2010
1 parent e473f2b commit 4cb661a591e6a4837248deed7cdff6e6b36fcc03
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/tach.rb
View
@@ -3,6 +3,8 @@
module Tach
+ STDOUT.sync = true
+
unless const_defined?(:VERSION)
VERSION = '0.0.7'
end
@@ -37,11 +39,9 @@ def initialize(times = 1, &block)
data << { :tach => name, :total => format("%8.6f", run_tach(name, @times, &block)) }
unless [name, block] == @benchmarks.last
print(', ')
- STDOUT.flush
end
end
print("]\n\n")
- STDOUT.flush
data.sort! {|x,y| x[:total].to_f <=> y[:total].to_f }
Formatador.display_table(data, [:tach, :total])
Formatador.display_line
@@ -56,7 +56,6 @@ def tach(name, &block)
def run_tach(name, count, &benchmark)
GC::start
print(name)
- STDOUT.flush
tach_start = Time.now
if benchmark.arity == 0

0 comments on commit 4cb661a

Please sign in to comment.