Last active
December 10, 2015 05:58
-
-
Save tjfontaine/4391835 to your computer and use it in GitHub Desktop.
simple comparison of identify command vs binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var imagick = require('imagick'); | |
var imagemagick = require('imagemagick'); | |
var path = require('path'); | |
var assert = require('assert'); | |
args = [ | |
'-format', | |
'~~~%w~~~%h~~~%x~~~%C', | |
path.resolve('./logo.png'), | |
]; | |
console.log('using:', args.join(' ')); | |
function test(count, start, lib, args, end) { | |
if (count <= 0) { | |
end(start); | |
return; | |
} | |
lib.identify(args, function (error, metadata) { | |
assert.strictEqual(metadata.trim(), '~~~245~~~66~~~72 Undefined~~~Zip'); | |
test(--count, start, lib, args, end); | |
}); | |
}; | |
var COUNT = 1000; | |
test(COUNT, Date.now(), imagick, args, function (start) { | |
console.log('imagick did', COUNT, 'in', (Date.now()-start)/1000, 'seconds'); | |
test(COUNT, Date.now(), imagemagick, args, function (start) { | |
console.log('imagemagick did', COUNT, 'in', (Date.now()-start)/1000, 'seconds'); | |
}); | |
}); | |
� | |
/* output | |
using: -format ~~~%w~~~%h~~~%x~~~%C /home/tjfontaine/development/test/logo.png | |
imagick did 1000 in 0.323 seconds | |
imagemagick did 1000 in 5.366 seconds | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment