Benchmarking mir.ndslice + lubeck against numpy and Julia

p.shkadzko p.shkadzko at gmail.com
Sun Jan 12 10:25:09 UTC 2020


On Sunday, 12 January 2020 at 07:04:00 UTC, Ola Fosheim Grostad 
wrote:
> On Saturday, 11 January 2020 at 21:54:13 UTC, p.shkadzko wrote:
>> Today I decided to write a couple of benchmarks to compare D 
>> mir with lubeck against Python numpy, then I also added Julia 
>> snippets. The results appeared to be quite interesting.
>
> A decent optimizer would remove all your code except the print 
> statement. Make sure to output the result of the computation. 
> Also make sure you use the same algorithms and accuracy. If you 
> write your own innerproduct in one language then you should do 
> so in the other languages as well and require the result to 
> follow ieee754 by evaluating the result.
>
> Please note that floating point code cannot be fully 
> restructured by the optimizer without setting the optimizer to 
> less predictable fast-math settings. So it cannot even in 
> theory approach hand tuned library code.

Yes, it all should be there, I was impatient to share the timings.

On the other hand, I believe that stating that D can be faster at 
something but you only have to know which compiler to use, 
correct flags, maybe don't use dub because its defaults are bad 
will never going to work. People will not spend time trying to 
figure all this out. There is already some compiler heritage one 
should be aware of when using D and I suspect a lot of other 
things. True that in order to make a fair comparison you should 
be an expert in all these things but then the results won't be 
representative of the beginners code. Python out-of-the-box gives 
you such guarantees saying: "here is a programming language for 
you that is easy as a toaster and btw be assured that it will run 
fast no matter what stupid thing you do". On top of that you have 
quite detailed and beginner friendly docs.

I shall keep checking out mir libs and lubeck to see what's more 
in there.


More information about the Digitalmars-d mailing list