Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Previews #12

Merged
merged 4 commits into from May 24, 2012
Merged

Previews #12

merged 4 commits into from May 24, 2012

Conversation

drewish
Copy link
Collaborator

@drewish 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.

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.
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.
Adding an example for getImagePreviews(). Switched the links to the
proper markdown syntax. Split up the examples to make them more readable.
@drewish
Copy link
Collaborator Author

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) {
      deferred.resolve();
    });
  }
});

suite
  .on('cycle', function(event, bench) {
    console.log(String(bench));
  })
  .on('complete', function() {
    console.log('Fastest is ' + this.filter('fastest').pluck('name'));
    console.log(this);
  })
  .run({ 'async': true });

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 added a commit that referenced this pull request May 24, 2012
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant