Skip to content

Instantly share code, notes, and snippets.

@jyurek
Created July 1, 2011 21:25
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 jyurek/1059428 to your computer and use it in GitHub Desktop.
Save jyurek/1059428 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'benchmark'
require 'dimensions'
pics = Dir.glob("/Users/jyurek/Pictures/[0-9a-zA-Z]*.*")
Benchmark.bmbm do |x|
x.report('imagemagick') do
pics[0..1000].each{|f| `identify -format '%wx%h' "#{f}" 2>&1`.split("x") }
end
x.report('dimensions') do
pics[0..1000].each{|f| Dimensions.dimensions(f) }
end
end
Rehearsal -----------------------------------------------
imagemagick 0.160000 1.470000 13.460000 ( 14.951678)
dimensions 0.240000 0.270000 0.510000 ( 0.521630)
------------------------------------- total: 13.970000sec
user system total real
imagemagick 0.160000 1.880000 13.980000 ( 14.503369)
dimensions 0.200000 0.290000 0.490000 ( 0.488729)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment