Monday, November 06, 2006

zip vs dmg

Most Cocoa developers use disk images (aka dmg) for distributing their softwares over the Internet. This is not really surprising as this is Apple's recommended practice for software distribution.

My gripe against this practice is simple: it's very slow. I did an experiment that I think is rather representative. I bundled a 1.9 MB application (Transmission) into both a zip file and a dmg file. I'm talking here about internet-enabled disk images, i.e. those which copy their content, unmount and go to trash automatically.

Here are the results of my experiment.

SizeTime
zip0.7 MB0.16 sec
dmg1.3 MB9.02 sec

Impressing, isn't it ? The size is almost twice bigger for the dmg although I used maximum compression (zlib level 9). That's bad (not all Mac users have a broadband connection) but what is worse is the time to prepare the disk image, verify the disk image, mount the disk image, clean up, check the download files, prepare the disk image, mount the disk image, copy the disk image, unmount the disk image and clean up. Yes, these are the ten operations required for an internet-enabled disk image to achieve the decompression! Zip decompression requires only two phases: decompressing the zip file and checking the downloaded files, thus it is 56 times faster.
Results may vary depending on application size and may be slightly different for a ten MB application but I can't see how a disk image could be either smaller or faster to decompress than a zip archive. If you know such an exemple, please post a comment about it.

Since Mac OS X 10.3, zip file compression and decompression is natively supported. Prior to Mac OS X 10.3, StuffIt Expander was bundled with Mac OS X. A convenient Create archive of "..." stands in the File menu of the Finder. It's simple and efficient, so why not using it ?

Some may argue that disk images are nice for drag & dropping the software into the Applications folder. While this is true, this is also very slow. When using a non internet-enabled disk image, users have to copy the application into the Applications folder which takes much more time than moving it. Moreover, they have to go to the desktop in order to unmount the disk image.

You have understood by now, I hate disk images and I hope more and more developers will use zip files in the future to distribute their softwares in order to save their users' precious time. ;-)

Finally, I suggest you have a look at these movies (no faking) showing how fast and how long it takes to decompress respectively a zip file and a dmg file.












4 comments:

Anonymous said...

Every person except for my self doesn't know how to instal an app when they first get on OS X. They all ways feel things need to be more complicated than they are.

If the beginning user downloads a DMG, then they use if from there and reload the DMG when they want to use the app! As silly as it sounds it happens every time.

If the App downloads to the beginner's desktop, then the beginner just use the app from their desktop! I kid you not.

The only fool prof instillation method I have seen is to use a DMG that has the application short cut inside of it. with very explicit direction and diagrams of how to instal the app.

Anonymous said...

If I'm not mistaken Apple want you to make .dmg .zipped files, both that is, for their download links page for software distrubution. That goes against Apples own developer instructions about using plain .dmg's. From that perspective I don't think there is much of an issue if you choose to use straight .zip files, wich goes against the developer notes.

Alex said...
This comment has been removed by a blog administrator.
Anonymous said...

Best college!! https://aab-edu.net/