Numpy vs Cython speed

前端 未结 5 1538
清酒与你
清酒与你 2020-11-28 22:37

I have an analysis code that does some heavy numerical operations using numpy. Just for curiosity, tried to compile it with cython with little changes and then I rewrote it

5条回答
  •  星月不相逢
    2020-11-28 23:20

    I'd guess the main overhead you are saving is the temporary arrays created. You create a great big array array - array[row, :], then reduce it into a smaller array using sum. But building that big temporary array won't be free, especially if you need to allocate memory.

提交回复
热议问题