RE: JFFS3 & performance

Joakim Tjernlund
2004-12-22T16:39:16Z

> On Wed, 22 December 2004 16:30:20 +0100, Joakim Tjernlund wrote:
> >
> > Can you do
> > 1) First run a forward and then a backward version on memory space >= 2*L1 cache
> > 2) Then do two forward runs on the same memory.
> >
> > Compare the delta between 1) and 2)
> > That should give a clue if it is worth having a backward version.
>
> In my private not-too-scientific hash-table test, I do a strlen()
> before calling engel32. The reverse version is 1.5% faster, even
> though the strings are in the 80byte arena. That's well over noise
> level.

OK, then there might be worth considering a reverse checksum.

>
> > > Adler32 beats the hell out of every other algorithm. Except for the
> > > backwards part, it appears to be a clear winner.
> >
> > Have you look at the assembler Engler32 generates? Every instruction counts
> > in such small loops.
>
> Not yet. Might be worth a try, though. Since it's losing in direct
> comparison, but equal in the hash test, it might be slightly stronger
> than adler32.

This generates a little better code on PPC.
Not tested.

uint32_t engel32r_new(uint32_t engel, const void *_s, size_t len)
{
const char *s = _s + len;
uint32_t sum=engel, prod=engel;
size_t new_len = len >> 2;
len &=3;

for ( ;new_len; --new_len) {
sum += *--s;
prod += sum;
sum += *--s;
prod += sum;
sum += *--s;
prod += sum;
sum += *--s;
prod += sum;
}
for (; len; len--) {
sum += *--s;
prod += sum;
}
sum = (sum&0x0000ffff)<<16^ (sum&0xffff0000)>>16;
sum = (sum&0x00ff00ff)<<8 ^ (sum&0xff00ff00)>>8;
sum = (sum&0x0f0f0f0f)<<4 ^ (sum&0xf0f0f0f0)>>4;
sum = (sum&0x33333333)<<2 ^ (sum&0xcccccccc)>>2;
sum = (sum&0x55555555)<<1 ^ (sum&0xaaaaaaaa)>>1;
prod ^= sum;
return prod;
}
>
> BTW: I reject the name "Engler32". Few names are worse than
> "engel32", but that one is. ;)

I am so sorry, I felt something was wrong when I wrote that but I didn't
check, my bad.

Jocke