Skip to content

Instantly share code, notes, and snippets.

@banister
Created October 16, 2009 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/211455 to your computer and use it in GitHub Desktop.
Save banister/211455 to your computer and use it in GitHub Desktop.
ruby bench_negate.rb
performing 30 iterations...
Rehearsal -------------------------------------------
Devil 0.110000 0.090000 0.200000 ( 0.264404)
RMagick 0.250000 0.230000 0.480000 ( 0.598489)
---------------------------------- total: 0.680000sec
user system total real
Devil 0.090000 0.080000 0.170000 ( 0.244527)
require 'rubygems'
require 'benchmark'
require 'RMagick'
require 'devil'
N = 30
puts "performing #{N} iterations..."
@dimg = Devil.load("texture.png")
@rimg = Magick::Image.read("texture.png").first
Benchmark.bmbm do |x|
x.report("Devil") {
N.times {
@dimg.dup.negative
}
}
x.report("RMagick") {
N.times {
@rimg.negate
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment