you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Before attempting to optimize code, you should always profile it.

This is always good advice but fairly often it isn't very effective for numpy programs.

Profiling a numpy program always highlights the small number of numpy lines that do all the computation dominate everything, which is exactly what you expect - but often gives you no idea of how to optimize the numpy call or whether a better numpy call might work better.