Sha256: cf45ce2ad1f4f94ac471b2d5c2e6a0af252c3bf69ed559cead8b3ff76acf5c39

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

require File.dirname(__FILE__) + "/loader"

# Create browser object
browser = create_browser
browser.goto(HTML_DIR + "/2000_spans.html")

TESTS = 100
res = Benchmark.bmbm do |results|
  results.report("Loop through all spans (n = 1)") do
    1.times do # Hard coded 1 run
      browser.spans.each do |span|
        span.text
      end
    end
  end

#  results.report("Loop through all spans (raw)") do
#    TESTS.times do
#      if RUBY_PLATFORM =~ /java/
#        browser.document.getHtmlElementsByTagName("span").each do |span|
#          span.asText
#        end
#      else
#        browser.document.getElementsByTagName("span").each do |span|
#          span.innerText
#        end
#      end
#    end
#  end

  results.report("Last span by id (String)") do
    TESTS.times do
      browser.span(:id, "id_2000").exists?
    end
  end

  results.report("Last span by id (Regexp)") do
    TESTS.times do
      browser.span(:id, "/2000/").exists?
    end
  end

end

puts
total = res.inject(0.0) { |mem, bm| mem + bm.real }
puts "total  : " + total.to_s
puts "average: " + (total/res.size.to_f).to_s

Version data entries

12 entries across 12 versions & 6 rubygems

Version Path
caius-celerity-0.0.6.11 benchmark/bm_2000_spans.rb
drnic-celerity-0.0.6.17 benchmark/bm_2000_spans.rb
celerity_thingista-0.9.3 benchmark/bm_2000_spans.rb
celerity_thingista-0.9.2 benchmark/bm_2000_spans.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/benchmark/bm_2000_spans.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/benchmark/bm_2000_spans.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/benchmark/bm_2000_spans.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/benchmark/bm_2000_spans.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/celerity-0.9.2/benchmark/bm_2000_spans.rb
celerity-0.9.2 benchmark/bm_2000_spans.rb
celerity-0.9.1 benchmark/bm_2000_spans.rb
no-click-exception-celerity-0.9.0 benchmark/bm_2000_spans.rb