Use less for-loops, use more vectorization

preview_player
Показать описание
2023 resolution: If you know a co-worker who default to using a trusty for loop to solve any numerical problem (eg the Accumulator Pattern), try to refactor it with the vectorization approach (implemented through numpy, written in C).
More concise, more efficient, and magnitudes FASTER.

Let's do our part in stopping unnecessarily slow code that is a product of habit and familiarity (we all love for-loops, but still).

Here's part 2 of 'no for loops':

Рекомендации по теме
Комментарии
Автор

I can't believe I'm the first comment after such a wonderful video but, Thank you very much.

pabloraindogarcia
Автор

excellent. Can you share your source code? Thanks.

zdravkomofardin
Автор

You should be more careful with the variable naming - n was both a global and a local, sum shadowing the built-in function name...

nccamsc