Re: [PATCH] af_unix: use shift instead of integer division

2006-02-24 Thread David S. Miller
From: Benjamin LaHaise <[EMAIL PROTECTED]> Date: Tue, 7 Feb 2006 06:54:44 -0800 > The patch below replaces a divide by 2 with a shift -- sk_sndbuf is an > integer, so gcc emits an idiv, which takes 10x longer than a shift by 1. > This improves af_unix bandwidth by ~6-10K/s. Also, tidy up the c

Re: [PATCH] af_unix: use shift instead of integer division

2006-02-07 Thread Benjamin LaHaise
On Tue, Feb 07, 2006 at 04:15:31PM +0100, Andi Kleen wrote: > On Tuesday 07 February 2006 15:54, Benjamin LaHaise wrote: > > > + if (size > ((sk->sk_sndbuf >> 1) - 64)) > > + size = (sk->sk_sndbuf >> 1) - 64; > > This is really surprising. Are you double plus sure gcc

Re: [PATCH] af_unix: use shift instead of integer division

2006-02-07 Thread Andi Kleen
On Tuesday 07 February 2006 15:54, Benjamin LaHaise wrote: > + if (size > ((sk->sk_sndbuf >> 1) - 64)) > + size = (sk->sk_sndbuf >> 1) - 64; This is really surprising. Are you double plus sure gcc doesn't do this automatically? -Andi - To unsubscribe from this l

[PATCH] af_unix: use shift instead of integer division

2006-02-07 Thread Benjamin LaHaise
The patch below replaces a divide by 2 with a shift -- sk_sndbuf is an integer, so gcc emits an idiv, which takes 10x longer than a shift by 1. This improves af_unix bandwidth by ~6-10K/s. Also, tidy up the comment to fit in 80 columns while we're at it. -ben Signed-off-by: B