On Tue, Aug 17, 2010 at 10:09 AM, Tim Bird <[email protected]> wrote:

> I think we must be talking about different signatures.  I'm referring
> to the one checked in frameworks/base/libs/utils/ZipFileRO.cpp,
> in ZipFileRO::parseZipArchive() about line 255 in the file:
>
>        localHdr = basePtr + localHdrOffset;
>        if (get4LE(localHdr) != kLFHSignature) {
>            LOGW("Bad offset to local header: %d (at %d)\n",
>                localHdrOffset, i);
>            goto bail;
>        }
>

Oh!  Yes I was thinking about something completely different.  This sounds
like a great optimization. :)


> Well, page faults are always inherently slower than reads, but you're right
> that
> they shouldn't be much slower.  I'm still trying to figure out why reading
> the
> resource table (apparently) reads every byte of that portion of the
> archive, as opposed
> to only accessing the data sparsely, as you indicate is the intent.
>

It is going to depend a lot on the resources...  all of the strings are in
one pool, so I could imagine they could be positioned there in such a way
that they are sparse in relation to what you need and cause a lot of page
faults.

Oh, another possibility -- the resource code tends to do a lot of validation
of the resource data at open time, so that when it retrieves things later it
doesn't need to repeatedly validate a bunch of stuff at each access.  This
may be causing many pages to be touched.

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to