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/[email protected]
[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

Reply via email to