On Thu, Sep 24, 2015 at 4:56 PM, Yichao Yu <yyc1...@gmail.com> wrote:
> On Thu, Sep 24, 2015 at 4:42 PM, Erik Schnetter <schnet...@gmail.com> > wrote: > > In the native code above, the C function `pow(double, double)` is called > in > > both cases. Maybe `llvm_powi` is involved; if so, it is lowered to the > same > > `pow` function. The speed difference must have a different reason. > > Not necessarily, IIRC. we use the openlibm functions by default but > llvm will use the system libm version. > Good catch. (I can't reproduce this locally, neither with Julia 0.4 nor 0.5, neither on OS X nor on Linux -- I'm getting different assembler code for both function, both different from the versions shown here, so I can't try my suggestion below.) To test this, you could comment out or modify the `llvm_powi` definition of `pow`, or you could rebuild Juila without Openlibm. -erik > > Sometimes there are random things occurring that invalidate benchmark > > results. (This could be caused by how the compiled functions are aligned > > respective to cache lines or page boundaries, etc. -- this is black > magic I > > like to invoke if there's a result that I can't explain. You can just > ignore > > my ramblings here.) You could restart Julia, reboot the machine, try a > > different machine, define several identical functions `f` and `f_float` > and > > look at their speeds, etc... > > > > (I would have hoped that this function is translated to the equivalent of > > `c=cos(x); c2=c*c; return c*c2`, but this is obviously not happening.) > > > > -erik > > > > On Thu, Sep 24, 2015 at 4:24 PM, Kristoffer Carlsson < > kcarlsso...@gmail.com> > > wrote: > >> > >> But the floating ones are the faster ones. Shouldn't it be the opposite? > > > > > > > > > > -- > > Erik Schnetter <schnet...@gmail.com> > > http://www.perimeterinstitute.ca/personal/eschnetter/ > -- Erik Schnetter <schnet...@gmail.com> http://www.perimeterinstitute.ca/personal/eschnetter/