Skip to content

Instantly share code, notes, and snippets.

@banister
Created October 16, 2009 00:54
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/211449 to your computer and use it in GitHub Desktop.
Save banister/211449 to your computer and use it in GitHub Desktop.
N = 100
puts "performing #{N} iterations..."
@dimg = Devil.load("tank.png")
@rimg = Magick::Image.read("tank.png").first
Benchmark.bmbm do |x|
x.report("Devil") {
N.times {
@dimg.dup.resize(100, 100)
}
}
x.report("RMagick") {
N.times {
@rimg.scale(100, 100)
}
}
end
@dimg.save("devil.png")
@rimg.write("magick.png")
ruby bench_scale.rb
performing 100 iterations...
Rehearsal -------------------------------------------
Devil 0.350000 0.010000 0.360000 ( 0.603116)
RMagick 0.710000 0.050000 0.760000 ( 0.894162)
---------------------------------- total: 1.120000sec
user system total real
Devil 0.340000 0.010000 0.350000 ( 0.456647)
RMagick 0.670000 0.050000 0.720000 ( 0.860319)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment