lkml.org 
[lkml]   [2015]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] lib/int_sqrt.c: Optimize square root function
From
On Thu, Feb 5, 2015 at 10:43 AM, Anshul Garg <aksgarg1989@gmail.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


\
 
 \ /
  Last update: 2015-02-05 21:01    [W:0.059 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site