Skip to content

Instantly share code, notes, and snippets.

@banister
Created October 16, 2009 01:00
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/211451 to your computer and use it in GitHub Desktop.
Save banister/211451 to your computer and use it in GitHub Desktop.
ruby bench_crop.rb
performing 500 iterations...
Rehearsal -------------------------------------------
Devil 1.390000 0.030000 1.420000 ( 1.597059)
RMagick 1.100000 0.730000 1.830000 ( 2.434424)
---------------------------------- total: 3.250000sec
user system total real
Devil 1.400000 0.030000 1.430000 ( 1.997350)
RMagick 1.170000 0.730000 1.900000 ( 2.972316)
require 'rubygems'
require 'benchmark'
require 'RMagick'
require 'devil'
N = 500
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.crop(100, 100, 200, 200)
}
}
x.report("RMagick") {
N.times {
@rimg.crop!(100, 100, 200, 200)
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment