I think this comparison is not fair since C++ version uses float32 and Julia 
float64 by default.
If you provide that information to the compiler the results are similar. 

function test1()
    a=2.0f32
    for i=1:1000000
        a+=exp(a%2.0f32);
    end
end

@time test1()

Julia elapsed time: 0.018281912 seconds (125220 bytes allocated)
C++   me 30000 clicks (0.030000 seconds).


Interstingly Julia's example using Integer in mod operation is slower:
a+=exp(a%2);
elapsed time: 0.049916461 seconds (304116 bytes allocated)

These toy benchmarks are pointless anyway.

Reply via email to