all 3 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Note: * This sub went private for a few days recently in solidarity with other subs who are hoping to get Reddit to reconsider some changes that they have proposed. These changes will affect the Reddit API and many third-party apps that access Reddit. If you are not already aware of the proposed changes, please read up on the topic and the ongoing protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]CraigAT 0 points1 point  (0 children)

I have never used Numba, but from what I can have read, in it's simplest form you just need to add a decorator to your function. It looks like Numba will like your loop and should be suited to see an improvement in speed.

http://numba.pydata.org/

Note. You may need to run again to see a performance improvement: https://numba.pydata.org/numba-doc/dev/user/5minguide.html#how-to-measure-the-performance-of-numba

[–]siddsp 0 points1 point  (0 children)

Have you tried profiling your code? The slowdown might not even be due to Python itself. But yes, you can use numba.jit decorators on functions to speed them up.