Sha256: 4ad87dd459b2cd9dcf4aeffa393fc5523fdde7efbb0873d322d5970435788bec

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

require 'win32ole'
require 'benchmark'

COUNT = (ARGV[0] || 250).to_i
ITERATIONS = (ARGV[1] || 5).to_i

ie = WIN32OLE.new('InternetExplorer.Application')


ITERATIONS.times do
  printf "visible+name #{COUNT} of 32 calls: "
  puts Benchmark.measure {
    COUNT.times do 
      ie.visible; ie.name; ie.visible; ie.name; ie.visible; ie.name
      ie.visible; ie.name; ie.visible; ie.name; ie.visible; ie.name
      ie.visible; ie.name; ie.visible; ie.name; ie.visible; ie.name
      ie.visible; ie.name; ie.visible; ie.name; ie.visible; ie.name
      ie.visible; ie.name; ie.visible; ie.name; ie.visible; ie.name
      ie.visible; ie.name
    end
  }

  printf "visible=false #{COUNT} of 32 calls: "
  puts Benchmark.measure {
    COUNT.times do 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false; ie.Visible = false; 
      ie.Visible = false; ie.Visible = false
    end
  }
end

ie.quit 



Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jruby-win32ole-0.8.5 samples/dispatch_bench.rb
jruby-win32ole-0.8.4 samples/dispatch_bench.rb
jruby-win32ole-0.8.3 samples/dispatch_bench.rb
jruby-win32ole-0.8.2 samples/dispatch_bench.rb
jruby-win32ole-0.8.1 samples/dispatch_bench.rb
jruby-win32ole-0.8.0 samples/dispatch_bench.rb