On Sep 17, 2013, at 10:03 , Graham Cox <graham....@bigpond.com> wrote:

> This is very much a worst-case. The file contains a 400MB embedded TIFF 
> image, which is the bottleneck. The archive probably only has a thousand 
> objects in it.

Ahh, so the ‘other' case:   rather than large numbers of objects, a few really 
large ones, or just one.  Potentially explains why saving is not that different 
from loading.  Is the TIFF compressed or uncompressed?

A large image calls for slightly different strategy.  If at all possible, you 
want to store the image data outside the keyed archive, for example as a 
separate file in your wrapper, keeping just a reference inside the archive.  
For example, unarchiving a 670MB TIFF/NSBitmapImageRep with NSKeyedUnarchiver 
takes around  5 seconds on my machine, even with the data already in the buffer 
cache, whereas reading that same TIFF/NSBitmapImageRep directly from a file 
just takes around 1.4 seconds.

Apart from making loading much faster, saving should be near instantaneous if 
you don’t modify the image data and optimize for that case by not re-saving the 
image.

> [delays in document loading invisible / disconcerting with background loading]


> Really, opening in the background is a bit pointless, as usually files open 
> near-instantaneously so blocking the main thread for that time is not an 
> issue, and the user's workflow suggests that the next thing they want to do 
> is work on the file they've just selected in the Open panel, not get on with 
> something else while it loads.

Yep, seems pretty pointless to me as well for normal use cases.  I think it 
becomes important when you are re-opening many documents automatically on 
launch, but that has always seemed at best somewhat iffy as well to me.  
Sometimes it is what I want, most times it’s not and I end up having to close a 
lot of documents after launch.

> So showing a progress for a lengthy open delay is likely to fit with the 
> user's workflow.

Or just opting out of background document reading.

> Saving in the background is much more beneficial, since the main thread 
> doesn't block significantly for autosave, etc.

If you can change things around as I wrote above, saving should also be near 
instantaneous.

Cheers,

Marcel


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to