[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crc32() optimization



The 2.5 crc stuff has not made it to 2.4 yet. I have written a patch
that backports the 2.5 crc stuff to 2.4 but it has not made it into 2.4 yet.
The crc32 impl. in 2.5 is basically the same as fs/jffs2/crc32.h. That
patch is needed if you want to run JFFS2 CVS HEAD on top of 2.4.

The optimization below will play just fine with 2.5 crc and will
make it faster.

          Jocke

> I wonder how this plays out with the 2.4.19 changes that move all crc32
> function to linux/lib.  Has anybody heard if the new crc32 stuff is faster
> than the support that was in fs/jffs2/crc32.h?
> 
> -Paul
> 
> 
> -----Original Message-----
> From: Joakim Tjernlund [mailto:Joakim.Tjernlund@xxxxxxx.se]
> Sent: Sunday, November 10, 2002 7:28 AM
> To: David Woodhouse
> Cc: jffs-dev@xxxxxxx.org
> Subject: crc32() optimization
> 
> 
> Hi David
> 
> This patch improves my scan time with 22%( from 2.39 to 1.86 seconds).
> Maybe you want to include it in the 2.4 branch.
> 
> I will put this in my next backport of the crc32 stuff from 2.5.
> 
>           Jocke
> 
> Index: fs/jffs2/crc32.h
> ===================================================================
> RCS file: /home/cvs/mtd/fs/jffs2/crc32.h,v
> retrieving revision 1.3
> diff -u -b -r1.3 crc32.h
> --- fs/jffs2/crc32.h    26 Feb 2001 14:44:37 -0000      1.3
> +++ fs/jffs2/crc32.h    10 Nov 2002 15:25:11 -0000
> @@ -13,7 +13,16 @@
>  crc32(__u32 val, const void *ss, int len)
>  {
>         const unsigned char *s = ss;
> -        while (--len >= 0)
> +        while (len >= 6){
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
> +         len -= 6;
> +        }
> +        while (len--)
>                  val = crc32_table[(val ^ *s++) & 0xff] ^ (val >> 8);
>          return val;
>  }
> 
> 
> To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
> the body of a message to majordomo@xxxxxxx.com

To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com