Mir vs. Numpy: Reworked!

jmh530 john.michael.hall at gmail.com
Fri Dec 4 14:48:32 UTC 2020


On Friday, 4 December 2020 at 02:35:49 UTC, data pulverizer wrote:
> [snip]
> NDSlice is even faster for this case - cool. Am I correct in 
> assuming that the data in the NDSlice is also a single array?

It looks like all the `sweep_XXX` functions are only defined for 
contiguous slices, as that would be the default if define a 
Slice!(T, N).

How the functions access the data is a big difference. If you 
compare the `sweep_field` version with the `sweep_naive` version, 
the `sweep_field` function is able to access through one index, 
whereas the `sweep_naive` function has to use two in the 2d 
version and 3 in the 3d version.

Also, the main difference in the NDSlice version is that it uses 
*built-in* MIR functionality, like how `sweep_ndslice` uses the 
`each` function from MIR, whereas `sweep_field` uses a for loop. 
I think this is partially to show that the built-in MIR 
functionality is as fast as if you tried to do it with a for loop 
yourself.


More information about the Digitalmars-d-announce mailing list