Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About Java performance on Mac OS X



Fabrizio Giudici wrote:

>I've been warned about that by another poster. Indeed there's a mix of JPG
>and "camera raw" files; the latter are read by my own code, which is in
>pure Java. At this point it's worth while to run some "partitioned" test
>(i.e. to have figures for each type of file). I'm starting to work at it.

Image metadata is frequently a small fraction of the overall image file's
size.  If you have to read the entire image-file just to extract metadata,
you will always be at a disadvantage.

Let's say an image-file is 2 MB, and the extractable metadata is 2 KB.
Let's also say that the max disk-read rate is 10 MB/sec.  Now, the ratio of
file-size to metadata size is 1024:1.  That is, you have to read 1K times
more data than you need.  Next, divide 40 MB/sec by 1K.  The net data-rate
for reading metadata falls to 10 KB/sec (slower than a floppy-disk).

The only way to improve this is to read less (i.e. improve the
read/metadata ratio) or to read much faster (orders of magnitude faster).
Since read-rate is limited by hardware, OS, and drivers outside your
control, that really only leaves one option: read less.

So, if you have minimal-read metadata extraction, i.e. you seek-and-read in
a random access fashion, then you are trading off the 1024:1 ratio of
wasted reads against the possibly slower seek operations.  Then the
question is, "Is seeking 1K times slower than sequential reading?".
Frankly, you'd have to measure it, but I'd bet seek/read wins in the vast
majority of cases.

Even if you have to write your own seek/read metadata extractors, it would
still be worthwhile.  First, concentrate on the most popular format: JPEG.
The format is well documented and standardized.  There may also be existing
code for a seek/read JPEG metadata extractor you can use.  Google for that.

Next, work down a list of image formats prioritized by popularity.  Once
you reach a certain number, 90% or more of images you encounter will be
covered, so you can leave the rest to be handled by the over-reading
conventional code.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.