lkml.org 
[lkml]   [2015]   [Feb]   [2]   [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 Mon, Feb 2, 2015 at 11:10 AM, Joe Perches <joe@perches.com> wrote:
    >
    > Perhaps removing the while and using fls(x) would be better.

    No. fls is often slow, and you then do have to also round it down to
    an even bit number etc, so it gets somewhat complex too.

    We *probably* have some argument range that we care more about, which
    is why I'd like to know what the profile is that triggered this
    optimization, and what the common argument range is.

    For example, one user is the cpu frequency governor, which seems to
    try to predict the length of the next sleep. The values can probably
    be anything (it has protections for overflowing into "long long"), but
    presumably the onyl time we care about performance is when it's called
    very very often, in which case I'm going out on a limb and saying that
    the intervals will be short, and the standard deviation of those
    intervals will also be small. So *maybe* that function really only
    cares about performance when we have small arguments. I dunno.

    Linus


    \
     
     \ /
      Last update: 2015-02-02 20:41    [W:4.526 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site