On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote:
This works but it does not look very efficient considering we flatten and then calling array twice. It will get even worse with 3D arrays.
And yes, benchmarks show that summing 2D arrays like in the example above is significantly slower than in numpy. But that is to be expected... I guess.
D -- sum of two 5000 x 6000 2D arrays: 3.4 sec. numpy -- sum of two 5000 x 6000 2D arrays: 0.0367800739913946 sec.