Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Previews #12

merged 4 commits into from May 24, 2012


None yet
1 participant

drewish commented May 21, 2012

I finally got the preview reading working correctly. Did some benchmarking and found that—as you'd guess—the performance was better when you did all the IO in the worker thread and copied the images across. It was about ~20% faster when reading 1.5MB JPEG previews from CR2 files. I want to see if there's a similar speed up loading the tags that way.

Anyway give this a look and let me know what you think.

drewish added some commits Apr 28, 2012

@drewish drewish Call it a baton again.
Back in the day Damian called the structure we use to pass data to and
from the worker thread with a baton but later changed it. I'd like to
bring it back and separate out the field used for writing tags into a
child structure. I think this will set us up nicely for adding a third
structure for reading preview images.
@drewish drewish Add support for reading image previews
Did some benchmarking and found that when running parallel tasks reading
previews it was better to do it in the worker thread and copy it over. Should
probably look at doing the same thing for the tag reading.
@drewish drewish Update the readme.
Adding an example for getImagePreviews(). Switched the links to the
proper markdown syntax. Split up the examples to make them more readable.

drewish commented May 23, 2012

Here's roughly the script I was using to do benchmarks (it's setup for testing getImageTags() right now):

#!/usr/bin/env node

var exiv = require('./exiv2')
  , async = require('async')
  , Benchmark = require('benchmark');

var files = [
  '/Users/amorton/Desktop/2012-02-11 16.43.21.cr2'
, '/Users/amorton/Desktop/2012-02-11 16.43.40.cr2'
, '/Users/amorton/Desktop/2012-02-11 16.43.30.cr2'
, '/Users/amorton/Desktop/2012-02-11 16.43.51.cr2'

var suite = new Benchmark.Suite;

suite.add('files', {
  'defer': true,
  'fn': function(deferred) {
    async.map(files, exiv.getImageTags, function(err, results) {

  .on('cycle', function(event, bench) {
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
  .run({ 'async': true });
@drewish drewish Read tags in worker thread.
I did some more bench marking after moving the reading to the worker thread
and found it getting 40% more operations per second when processing multiple
files. It also let us clean up some of the Baton code too.

@drewish drewish added a commit that referenced this pull request May 24, 2012

@drewish drewish Merge pull request #12 from drewish/previews
Adding support for extracting preview images.

Also includes some performance improvements for reading tags.

@drewish drewish merged commit a252e69 into dberesford:master May 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment