[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <OF50A5C1AE.3C914FB7-ONC12578FE.002C31F1-C12578FE.002D6AFD@transmode.se>
Date: Thu, 1 Sep 2011 10:16:05 +0200
From: Joakim Tjernlund <joakim.tjernlund@...nsmode.se>
To: Bob Pearson <rpearson@...temfabricworks.com>
Cc: akpm@...ux-foundation.org, fzago@...temfabricworks.com,
George Spelvin <linux@...izon.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 04/10] crc32-add-pointer-to-tab.diff
Bob Pearson <rpearson@...temfabricworks.com> wrote on 2011/09/01 00:30:06:
> From: Bob Pearson <rpearson@...temfabricworks.com>
> To: linux-kernel@...r.kernel.org
> Cc: fzago@...temfabricworks.com, rpearson@...temfabricworks.com, Joakim Tjernlund <joakim.tjernlund@...nsmode.se>, George Spelvin <linux@...izon.com>, akpm@...ux-foundation.org
> Date: 2011/09/01 00:30
> Subject: [PATCH v6 04/10] crc32-add-pointer-to-tab.diff
>
> Replace 2D array references by pointer references in loops.
> This change has no effect on X86 code but improves PPC
> performance.
>
> Signed-off-by: Bob Pearson <rpearson@...temfabricworks.com>
Yes, this makes a significant difference on ppc32, your self test
went from
crc32: self tests passed, processed 225944 bytes in 2257673 nsec
to
crc32: self tests passed, processed 225944 bytes in 1949869 nsec
About 15% faster.
Technically this is my patch so I am adding my SOB:
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@...nsmode.se>
>
> ---
> lib/crc32.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> Index: for-next/lib/crc32.c
> ===================================================================
> --- for-next.orig/lib/crc32.c
> +++ for-next/lib/crc32.c
> @@ -53,20 +53,21 @@ static inline u32
> crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256])
> {
> # ifdef __LITTLE_ENDIAN
> -# define DO_CRC(x) crc = tab[0][(crc ^ (x)) & 255] ^ (crc >> 8)
> -# define DO_CRC4 crc = tab[3][(crc) & 255] ^ \
> - tab[2][(crc >> 8) & 255] ^ \
> - tab[1][(crc >> 16) & 255] ^ \
> - tab[0][(crc >> 24) & 255]
> +# define DO_CRC(x) (crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8))
> +# define DO_CRC4 crc = t3[(crc) & 255] ^ \
> + t2[(crc >> 8) & 255] ^ \
> + t1[(crc >> 16) & 255] ^ \
> + t0[(crc >> 24) & 255]
> # else
> -# define DO_CRC(x) crc = tab[0][((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
> -# define DO_CRC4 crc = tab[0][(crc) & 255] ^ \
> - tab[1][(crc >> 8) & 255] ^ \
> - tab[2][(crc >> 16) & 255] ^ \
> - tab[3][(crc >> 24) & 255]
> +# define DO_CRC(x) (crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8))
> +# define DO_CRC4 crc = t0[(crc) & 255] ^ \
> + t1[(crc >> 8) & 255] ^ \
> + t2[(crc >> 16) & 255] ^ \
> + t3[(crc >> 24) & 255]
> # endif
> const u32 *b;
> size_t rem_len;
> + const u32 *t0 = tab[0], *t1 = tab[1], *t2 = tab[2], *t3 = tab[3];
>
> /* Align it */
> if (unlikely((long)buf & 3 && len)) {
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists