> But for fastest transcendental function performance, I assume that one 
must use the micro-coded versions built into the processor's FPU--Is that 
what the fast libm implementations do?

Not at all. Libm's version of log() is about twice as fast as the CPU's own 
log function, at least on a modern x86_64 processor (really fast log 
implementations use optimized look-up tables). I had a look at your code 
and it seems that the 'consumption' variable is always in the very narrow 
range of 0.44950 to 0.56872. If you plot the log function in this tiny 
range, it is very flat and linear. I think that if you simply replaced it 
with a 2- or 4-part piecewise approximation, you could get significant 
speedup across the board, in julia, c++, and others, with only a very small 
approximation error.

On Tuesday, June 17, 2014 3:52:07 AM UTC+12, Florian Oswald wrote:
>
> Dear all,
>
> I thought you might find this paper interesting: 
> http://economics.sas.upenn.edu/~jesusfv/comparison_languages.pdf
>
> It takes a standard model from macro economics and computes it's solution 
> with an identical algorithm in several languages. Julia is roughly 2.6 
> times slower than the best C++ executable. I was bit puzzled by the result, 
> since in the benchmarks on http://julialang.org/, the slowest test is 
> 1.66 times C. I realize that those benchmarks can't cover all possible 
> situations. That said, I couldn't really find anything unusual in the Julia 
> code, did some profiling and removed type inference, but still that's as 
> fast as I got it. That's not to say that I'm disappointed, I still think 
> this is great. Did I miss something obvious here or is there something 
> specific to this algorithm? 
>
> The codes are on github at 
>
> https://github.com/jesusfv/Comparison-Programming-Languages-Economics
>
>
>

Reply via email to