blockimgdiff: selectively convert 'diff' commands to 'new' to reduce stash size
We cannot simultaneously stash more blocks than the size limit imposed by the cache size. As a result, some 'diff' commands will be inevitably converted to new. We used to do this conversion blindly when iterating through the transfer list. This leads to an unintended large package. In order to choose the right transfers to convert, we calculate the size of the compressed data, and build a heuristic about the package size increase to remove each stash blocks. After the process, the given package size for the watch device further reduces from 186M->155M. In some rare cases, the removed stashed blocks don't directly contribute to the maximum simultaneously stashed size. For example, stash A: 10 blocks stash B: 5 blocks free B: 5 blocks <-- stash B has been freed before we reach max stashed blocks stash C: 10 blocks Converting these blocks lead to an uncertain result. On one hand, patches are generally smaller than the new data; while on the other hand, the regenerated graph may have fewer order violation and thus give some size reduction. But these cases are rare and it seems an overkill to consider all possible scenarios here. Bug: 120561199 Test: build non-A/B incrementals and check the size (p.s. it can be tested on all target files with customed cache threshold) Change-Id: I599420a91b80f1a1d83d22ee1b336b699050cfb4
Loading
Please register or sign in to comment