[Groonga-commit] groonga/grntest [master] inplace reporter: reduce the number of redraws

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 11 18:50:42 JST 2012


Kouhei Sutou	2012-08-11 18:50:42 +0900 (Sat, 11 Aug 2012)

  New Revision: 8341b80341c0e972bdf7b8f29b6907466d3b556d
  https://github.com/groonga/grntest/commit/8341b80341c0e972bdf7b8f29b6907466d3b556d

  Log:
    inplace reporter: reduce the number of redraws

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+6 -0)
===================================================================
--- lib/groonga/tester.rb    2012-08-11 18:32:53 +0900 (f1d7137)
+++ lib/groonga/tester.rb    2012-08-11 18:50:42 +0900 (0ef2466)
@@ -1591,6 +1591,8 @@ EOF
       def initialize(tester)
         super
         @mutex = Mutex.new
+        @last_redraw_time = Time.now
+        @minimum_redraw_interval = 0.1
       end
 
       def start(result)
@@ -1709,12 +1711,16 @@ EOF
 
       def redraw
         @mutex.synchronize do
+          unless block_given?
+            return if Time.now - @last_redraw_time < @minimum_redraw_interval
+          end
           draw
           if block_given?
             yield
           else
             up_n_lines(n_using_lines)
           end
+          @last_redraw_time = Time.now
         end
       end
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index