Sha256: b4ef9a15f91ccc7676143c8a153d8d5c11d69d4caa7949e7e22e6bc54dc6caea

Contents?: true

Size: 795 Bytes

Versions: 9

Compression:

Stored size: 795 Bytes

Contents

require 'benchmark'
require File.join(File.dirname(__FILE__), 'test_helper')

@whisky = Whisky.new({})
Benchmark.bmbm do |x|
  x.report("normal") do 
    1_000.times do 
      @whisky.origin = "<script>foo</script>"
      @whisky.instance_variable_set(:@origin, "<script>foo</script>")
      @whisky.origin
    end 
  end
  x.report("cleansed") do 
    1_000.times do 
      @whisky.name = "<script>foo</script>"
      @whisky.instance_variable_set(:@name, "<script>foo</script>")
      @whisky.name
    end 
  end
  x.report("writer only") do 
    1_000.times do @whisky.name = "<script>foo</script>" end 
  end
  x.report("reader only") do 
    1_000.times do 
      @whisky.instance_variable_set(:@name, "<script>foo</script>")
      @whisky.name = "<script>foo</script>" 
    end 
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
thumblemonks-inquisition-0.1.0 test/performance.rb
thumblemonks-inquisition-0.1.1 test/performance.rb
thumblemonks-inquisition-0.1.2 test/performance.rb
thumblemonks-inquisition-0.1.3 test/performance.rb
thumblemonks-inquisition-0.1.4 test/performance.rb
thumblemonks-inquisition-0.2 test/performance.rb
inquisition-0.3.1 test/performance.rb
inquisition-0.3 test/performance.rb
inquisition-0.2 test/performance.rb