开发者

Is it better to .zip the data before downloading?

I have A LOT开发者_开发问答 of (optional) audio files.. I have 6400 audio files, with average size ~40 kb each, and total size ~400 mb..

I was wondering how will I download the files, Is it better to:

  1. download a .zip file and then extract .. less bandwidth , more sdcard space requireed , more cpu to unzip..
  2. download all the files (no .zip file)... more bandwidth , less sdcard and less cpu..

What is more reasonable?


Do a little test first...
Most audio files are already compressed, and Zipping them does not always reduce the size.

And if you can get only a small reduction with a high compression (= high CPU demand) setting then zipping will not be worth it.

You will have to measure to see on what side of the tipping point your files are.


Zipping should you give you a much faster download, as a single connection for download will be faster than openning 6400 HTTP request. (for small files, the time it takes to download is lower than the time it takes to open the connection. But the connection opening is constant, so for a large file you'll have much less time spend on opening connections.)
However, and that's the big point, most users won't be able to download 400MB easily without the network connection dropping. I'd suggest a middle way. Package the audio files into chunks or say 64 files each, (best in directories for faster access and reference) and download 64 files in a single zip or tar for that matter. I'd go with a non-compressing format, as the zipping won't give you much size reduction.

That way, you won't have to worry much about the download failing, and you'll have easy progress tracking.

However, i'd think about if you really need that many files in the first place.

Look if you either just have one biger mp3 file in which you can just play certain areas (just skipping inside the file) when you need it.
I'd also give a thought to lazy loading, just load the files when you need them


There's no need to compress etc .mp3 .flac .ogg but if it's for example a wave file you can compress the size pretty much.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜