On Thu, Apr 17, 2008 at 4:58 PM, Ernest Prabhakar
<[EMAIL PROTECTED]> wrote:
> On that note, can any suggest a good way to measure the performance of
> various Shoes functions, especially drawing?
>

#I'm sure I'm reinventing the wheel here, but here's something:
class SimplestTimer
  def initialize in_name
    @name = in_name
    @start_time = Time.now
  end

  def stop
    alert "[EMAIL PROTECTED]: #{Time.now - @start_time}seconds"
  end
end

Shoes.app :width=>600, :height=>450 do

  button "Slow" do
    the_timer = SimplestTimer.new "Slow"
    1.upto(60) do |theta|
      append {line 0, 0, theta*10, 450}
    end
    the_timer.stop
  end

  button "Fast" do
    the_timer = SimplestTimer.new "Fast"
    append do
      1.upto(60) do |theta|
        line 600, 0, theta*10, 450
      end
    end
    the_timer.stop
  end

end

Reply via email to