Mir vs. Numpy: Reworked!

jmh530 john.michael.hall at gmail.com
Thu Dec 3 17:08:58 UTC 2020


On Thursday, 3 December 2020 at 16:27:59 UTC, 9il wrote:
> Hi all,
>
> Since the first announcement [0] the original benchmark [1] has 
> been boosted [2] with Mir-like implementations.
>
> D+Mir:
>  1. is more abstract than NumPy
>  2. requires less code for multidimensional algorithms
>  3. doesn't require indexing
>  4. uses recursion across dimensions
>  5. a few times faster than NumPy for non-trivial real-world 
> applications.
>
> Why Mir is faster than NumPy?
>
> 1. Mir allows the compiler to generate specialized kernels 
> while NumPy constraints a user to write code that needs to 
> access memory twice or more times.
>
> Another Mir killer feature is the ability to write generalized 
> N-dimensional implementations, while Numpy code needs to have 
> separate implementations for 1D, 2D, and 3D cases. For example, 
> the main D loop in the benchmark can compile for 4D, 5D, and 
> higher dimensional optimizations.
>
> 2. @nogc iteration loop. @nogc helps when you need to control 
> what is going on with your memory allocations in the critical 
> code part.
>
> [0] 
> https://forum.dlang.org/post/pemharpztorlqkxdooul@forum.dlang.org
> [1] https://github.com/typohnebild/numpy-vs-mir
> [2] https://github.com/typohnebild/numpy-vs-mir/pull/1
>
> The benchmark [1] has been created by Christoph Alt and Tobias 
> Schmidt.
>
> Kind regards,
> Ilya

Looks good, but a few typos:

"The big difference is especially visible in this figures."

"For bigger prolem sizes the FLOP/s slightly drop and finally 
level out."

"Propably this is mainly caused by the overhead of the Python 
interpreter and might be reduced by more optimization efforts."


More information about the Digitalmars-d-announce mailing list