Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

What does "zipalign" mean and what is its significance?

When a ROM claims to be "zipaligned" what does that mean and what the difference from a ROM that is not "zipaligned"?

share|improve this question
add comment

1 Answer 1

up vote 18 down vote accepted

This mechanism is described at the Android developers site as follows:

zipalign is an archive alignment tool that provides important optimization to Android application (.apk) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the .apk, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.

In short: .apk content can be easier/faster/more optimal accessed due to the order of data inside the packed file.

For deeper information, there's a "complete guide" available at AddictiveTips: What Is Zipalign In Android And How To Make Apps Zipaligned, which answers the second part of your question:

Quite understandably, situation would be reserved for unaligned application packages. Resource reading would be slow and memory usage would be on the higher end of the spectrum. It would also depend on how many unaligned applications are present. For example, if less number of applications with an unaligned home application, you’d see slower application launch times. This is the best case scenario. For a worst case scenario, having a number of unaligned applications will result in the system repeatedly starting and killing processes, struggling with lags and huge battery drain.

share|improve this answer
    
For programmers it's more or less similar to struct alignment in C. Don't do struct x { uint16_t id; uint32_t data[100]; }; if you want it to be 32-bit aligned; use struct x { uint16_t id; uint16_t padding; uint32_t data[100]; }; –  Matthew Read Sep 24 '12 at 16:34
    
There appears to be no downside do why aren't all apps zip aligned? Also is this really even a concern for end users or is it only relevant to developers? –  Matt Sep 24 '12 at 20:53
1  
It's an additional step for the dev I'd say. And of course the performance is a concern for end users ;) –  Izzy Sep 24 '12 at 21:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.