3 ms·
That particular for-loop in a dynamically typed language is pretty much a worst-case scenario for the interpreter. I think one should just vectorize the soluti
by vmchale 5y ago
That particular for-loop in a dynamically typed language is pretty much a worst-case scenario for the interpreter.
I think one should just vectorize the solution from the get-go! np.accumulate looks like the right way to go about things in this example.
Btw the J implementation would be >. /\ and the k implementation would be |\ which is I think much better than the for loop anyway.