[Zlib-devel] Performance patch set
stefanfuhrmann at alice-dsl.de
Mon May 10 04:52:01 EDT 2010
Joakim Tjernlund wrote:
>> Hi devs,
>> as I wrote some time ago, I have been working on
>> Subversion performance issues and came across
>> some optimization potential in zlib as well.
>> Inflate is now about 50% faster and a few minor
>> optimizations for deflate were done along the way,
>> Although the changes are mostly independent
>> from each other, it would have been difficult to
>> create truly independent patches. Therefore, it's
>> all in one package. The patch was made against
>> 1.2.5 release version.
> I just browsed your patch and noticed you are touching inffast where
> I already have an optimization pending. I thing it would be
> useful for you too. See below.
I had noticed your work but wasn't sure whether it
already got accepted and so on. So, I decided to
post a patch that only contains my ideas.
From what I understood, it should be possible to
add your changes to mine. You did:
* align the target memory address
-> I will give it a try. Since we can only align
one side of the copy, the other may still be unaligned.
So, you reduce the frequency of unaligned accesses
from 50% to 25%.
* copy in larger chunks
-> I do that as well. With (sometimes much) larger chunks.
The new idea is that you don't have to worry about
the 'len' value: you can copy more, i.e. if the next chunk
would partially exceed len, you can still copy it.
* memset for dist==1
-> I tried that but it had no measurable effect
because it was too rare. But I may just re-add it
since the 'dist is too short' case is relatively rare
in my case anyway. Adding checks there won't
hurt the overall performance.
More information about the Zlib-devel