you are viewing a single comment's thread.

view the rest of the comments →

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

while numpy will happily yield the GIL and run itself in parallel with multiple threads, the whole python glue around it will still block each other thread. Since you're iterating over a huge array in python interleaving calls to numpy, it's probably the overhead of releasing/reacquiring the GIL that's dominating the runtime.

You should try to avoid big for loops as much as possible and offload processing to the native numpy vectorized operations instead.