3 ms·
I don’t know if numpy fixed this, but it used to be that mixing Python numbers with numpy in a tight loop is horribly slow. Try hoisting max_dist out of the loo
by zarzavat 4y ago
I don’t know if numpy fixed this, but it used to be that mixing Python numbers with numpy in a tight loop is horribly slow. Try hoisting max_dist out of the loop and replacing it with max_dist_np that converts it to a numpy float once.
- akasakahakada 4y agoSpeaking of this, I once find that for x in numpy.array: is 9X slower than for x in numpy.array.tolist(): in 2021.