Sha256: 8837a39a05e4a5bb20ae1e6707c7808f544569900b8344c14797b50c7a005a0e

Contents?: true

Size: 961 Bytes

Versions: 2

Compression:

Stored size: 961 Bytes

Contents

require 'benchmark'
require File.dirname(__FILE__) + '/para_creator'

Shoes.app do
  extend ParaCreator

  def benchmark_paras
    Benchmark.bm do |benchmark|
      benchmark.report '100' do
        create_paras 100
      end

      # this already hangs on shoes 3
      benchmark.report '1000' do
        create_paras 1000
      end
    end
  end

  def benchmark_paras_stacks_flows
    Benchmark.bm do |benchmark|
      benchmark.report '100' do
        create_stack_flows 100
      end

      benchmark.report '500' do
        create_stack_flows 500
      end
    end
  end

  def create_stack_flows(count)
    count.times do
      stack do
        flow do
          para ParaCreator::LOREM_IPSUM
        end
        flow do
          para ParaCreator::LOREM_IPSUM
        end
      end
    end
  end

  button 'benchmark paras' do
    benchmark_paras
  end

  button 'benchmark paras with some stacks and flows' do
    benchmark_paras_stacks_flows
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-4.0.0.pre2 benchmark/paras.rb
shoes-4.0.0.pre1 benchmark/paras.rb