PDA

View Full Version : App Store Download, Compression, and SQLite




TheProperNoun
Apr 20, 2009, 02:38 PM
I'm developing an App that uses an approximately 22MB SQLite database, largely filled with text data. My goal is to decrease the size enough to fit my application through the 10MB eye of the G3 needle... Using 7-zip I can compress it to 30% of that size, and using zlib I can get it down to about 40%. So now that I know that the data can be compressed, and compressed well, I have several questions. First, does the Apple Store automatically compress packages to be downloaded? Second, if it does not, is there an install phase where I can decompress my DB (as opposed to doing it on the first run of my app... I know that after an app finishes downloading, under the blue progress bar where it says downloading, it changes to installing...)? Third, is there any way for me to decompress the result of a 7-zip compression on the iPhone, or am I stuck at the 40% compression ratio?

On a side note, I'm worried about the efficiency of the SQLite DB. A large number of fields are single characters, others I know are integers that can be represented with 2 bytes. SQLite is dynamically typed, and the few types it has are some of the least efficient types available for DBs (i.e., no varchar(n), just text!) It takes me about 20 seconds to generate the DB from the ASCII file on a rather powerful desktop, so I'm pretty certain I'm stuck with the DB I transmit. So here's question four: can SQLite open other database formats created with stricter types? I.E., I create a DB where some fields are varchar(1), I open it with SQLite, and then SQLite treats it generically like text like it normally does... I'm fine with however SQLite wants to treat the data once in memory, it's a read-only DB, I'm mostly worried about the size of the download.

And here's a fifth question - mostly philosophical - why? Why in the world did Apple choose a dynamically typed DB framework to support for the iPhone, one that only supports the least efficient types?

Thanks!
Jonathan