[Zlib-devel] Performance patch set
Joakim Tjernlund
joakim.tjernlund at transmode.se
Tue May 11 03:52:08 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,
> >> too.
> >>
> >> 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.
> >>
> >
> > Hi
> >
> > 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.
> >
> >
> Hi Jocke!
Hi :)
>
> 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.
I see, then my patch can be adapted to this as well I guess.
>
> * 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.
It is not a real memset and it is valid for dist == 2 too. It is faster than going
back to byte copies.
I do think this should be made in steps.
Fist add my patch, add some other part and so on
will be much easier to review a trouble shoot.
Jocke
More information about the Zlib-devel
mailing list