[phobos] Ndslice speed
Martin Nowak via phobos
phobos at puremagic.com
Thu Dec 29 17:34:47 PST 2016
On 08/27/2016 09:43 PM, Matthias Redies via phobos wrote:
> I've come across the library experimental.ndslice, which is supposed
> to mimic NumPy. In order to test it I wrote a very crude matrix
Posting a reply from Ilya here:
It is incorrect to compare the same code for ndslice and fortran because:
1. current ndslice is numpy like vectors (matrixes are always has both
string and raw strides).
2. m[i, j] can not be vectrized for non-strided vectors too because D
language constraint: D has not macros engine; operator overloading for
[i, j] destruct vectorisation for LDC and GDC.
You can achieve the same speed as fortran if you will use
mir.ndslice.algorithm . It is available at  (with mir.ndslice).
The blog post is about mir.ndslice.algorithm can be found at . An LDC
compiler should be used (DMD is supported but it is too slow).
We are working on new version of ndslice, which will include classic
BLAS-like matrixes, and will simplify mir.ndslice.algorithm logic 
(it is still can not be used, will be released during one month). With
new ndslice m[i, j] will be still slow, however indexing as m[i][j] will
be fast as fortran.
In general forward access (front/popFront) is more user-friendly for
vectorisation then random access (indexing like [i, j]).
Please use mir.ndslice.algorithm for now.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 839 bytes
Desc: OpenPGP digital signature
More information about the phobos