[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HOOsj5ew4JnMpSraN+_ddAbstG=_0qOdAw2quXN-Knk-DJMw@mail.gmail.com>
Date: Thu, 5 Feb 2015 10:43:33 -0800
From: Anshul Garg <aksgarg1989@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
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:33 AM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Thu, Feb 5, 2015 at 10:20 AM, Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
>>
>> Hmm. I did that too [..]
>
> Side note: one difference in our results (apart from possibly just CPU
> uarch details) is that my loop goes to 100M to make it easier to just
> time it. Which means that my load essentially had about three more
> iterations over nonzero data.
>
> Linus
I have also done the same testing on 100 million numbers.
Attaching source codes.
Below is the result ::
int_sqrt_old - current
int_sqrt_new - With proposed change
anshul@...ntu:~/kernel_latest/sqrt$ time ./int_sqrt_old
real 0m41.895s
user 0m36.490s
sys 0m0.365s
anshul@...ntu:~/kernel_latest/sqrt$ time ./int_sqrt_new
real 0m39.491s
user 0m36.495s
sys 0m0.338s
I have run this test on Intel(R) Core(TM) i3-4000M CPU @ 2.40GHz VMWare Machine.
Please check if i am doing anything wrong.
NOTE ::
I have not used gcc optimizations while compilation.
With O2 level optimization proposed solution is taking more time.
View attachment "int_sqrt_old.c" of type "text/x-csrc" (721 bytes)
View attachment "int_sqrt_new.c" of type "text/x-csrc" (750 bytes)
Powered by blists - more mailing lists