Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23375

Python⇒Speed: The wrong way to speed up your code with Numba

$
0
0

If your NumPy-based code is too slow, you can sometimes use Numba to speed it up. Numba is a compiled language that uses the same syntax as Python, and it compiles at runtime, so it’s very easy to write. And because it re-implements a large part of the NumPy APIs, it can also easily be used with existing NumPy-based code.

However, Numba’s NumPy support can be a trap: it can lead you to missing huge optimization opportunities by sticking to NumPy-style code. So in this article we’ll show an example of:

  • The wrong way to use Numba, writing NumPy-style full array transforms.
  • The right way to use Numba, namely for loops.
Read more...

Viewing all articles
Browse latest Browse all 23375

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>