All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Anshul Garg <aksgarg1989@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	anshul.g@samsung.com
Subject: Re: [PATCH] lib/int_sqrt.c: Optimize square root function
Date: Mon, 02 Feb 2015 20:47:23 -0800	[thread overview]
Message-ID: <1422938843.2293.4.camel@stgolabs.net> (raw)
In-Reply-To: <CA+55aFw97rV3yHVtCoS0CySLpziYOMBxY+U4QsVEw+8o8gZDXQ@mail.gmail.com>

On Mon, 2015-02-02 at 11:00 -0800, Linus Torvalds wrote:
> Hmm. I don't disagree, but would like some more feedback.
> 
> Davidlohr - you were the person to touch this function last (commit
> 30493cc9dddb: "lib/int_sqrt.c: optimize square root algorithm"), and
> you did so for performance reasons. And in fact, when you did that,
> you removed that initial loop:
> 
> -       one = 1UL << (BITS_PER_LONG - 2);
> -       while (one > op)
> -               one >>= 2;
> 
> but I'm not sure that was actually all that conscious, I think the
> real optimization was the changes inside the loop to make the final
> real loop faster and simpler.

I missed that. And yes, the real optimization should be in the loop.

> 
> Also, you had performance numbers, so presumably a test harness for it
> all. It probably depends a lot on the actual distribution of argument
> values, of course, but it would be good to accompany the patch with
> actual real numbers like lasty time.

Aha. In my case I recall I ran a usersapce program using each function
from 1 to a million, and throwing perf at it for 10 times.

> (I'm also not entirely sure what uses int_sqrt() that ends up being so
> performance-critical, so it would be good to document that too, since
> that probably also matters for the "what's the normal argument range"
> question..)

It's not a big deal afaik.

Thanks,
Davidlohr


  parent reply	other threads:[~2015-02-03  4:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 17:12 [PATCH] lib/int_sqrt.c: Optimize square root function Anshul Garg
2015-02-02 19:00 ` Linus Torvalds
2015-02-02 19:13   ` Linus Torvalds
2015-02-03  4:41     ` Davidlohr Bueso
2015-02-03  4:57       ` Davidlohr Bueso
2015-02-03 15:54       ` Anshul Garg
2017-07-20 11:24     ` Peter Zijlstra
2017-07-20 11:52       ` Joe Perches
2017-07-20 14:13         ` Peter Zijlstra
2017-07-20 15:27       ` Peter Zijlstra
2017-07-20 18:31       ` Linus Torvalds
2017-07-20 22:34         ` Peter Zijlstra
2017-07-20 23:24           ` Linus Torvalds
2017-07-21 11:40             ` Peter Zijlstra
2017-07-21 12:15               ` Joe Perches
2017-07-21 13:26                 ` Peter Zijlstra
2017-07-21 13:33                   ` Peter Zijlstra
2015-02-03  4:47   ` Davidlohr Bueso [this message]
2015-02-03 15:42     ` Anshul Garg
2015-02-05 18:20       ` Linus Torvalds
2015-02-05 18:33         ` Linus Torvalds
2015-02-05 18:43           ` Anshul Garg
2015-02-05 19:37             ` Linus Torvalds
2015-02-08 15:39               ` Anshul Garg
2015-02-02 19:10 ` Joe Perches
2015-02-02 19:39   ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2015-01-29 13:35 Anshul Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422938843.2293.4.camel@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=aksgarg1989@gmail.com \
    --cc=anshul.g@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.