[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFw1xzW7b3monwTHGfu7YcbrCcgQVydLzJHBSV5zL4tDeQ@mail.gmail.com>
Date: Thu, 5 Feb 2015 11:37:00 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Anshul Garg <aksgarg1989@...il.com>
Cc: Davidlohr Bueso <dave@...olabs.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"anshul.g@...sung.com" <anshul.g@...sung.com>
Subject: Re: [PATCH] lib/int_sqrt.c: Optimize square root function
On Thu, Feb 5, 2015 at 10:43 AM, Anshul Garg <aksgarg1989@...il.com> wrote:
>
> NOTE ::
> I have not used gcc optimizations while compilation.
> With O2 level optimization proposed solution is taking more time.
The thing is, the kernel is compiled with -O2, so that's what matters.
Also, for very tight loops like this, the major costs tend to be very
subtle microarchitectural details, particularly branch prediction.
Which in turn end up sometimes depending on just exactly where the
branches were placed, and even whether two conditional branches were
in the same 8-byte aligned region etc things (because the branch
prediction might be done ignoring the low bits of the EIP etc). So not
only does the exact microarchitecture matter, things that don't *seem*
like they should matter can change behavior a lot.
My point is really that the performance numbers are very ambiguous.
The patch may well help in some situations, but hurt in others.
Linus
--
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