How to make Python run as fast (or faster) than Julia

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Feb 26 04:22:57 EST 2018


On Sun, 25 Feb 2018 21:19:19 -0800, Rick Johnson wrote:


> I agree with your sarcasm. And that's why these types of auto
> conversions should be optional. I agree that most times it's more
> practical to let python handle the dirty details. But in some cases,
> where you need to squeeze out a few more drops of speed juice, you won't
> mind the extra trouble.

And that's where you call out to a library like numpy, or write a C 
extension, or use a tool like Numba or Cython to optimise your Python 
code to use native ints. (Numba is still a work in progress, but Cython 
is a mature working product.)

Or to put it another way... if you want machine ints in Python, the way 
you get them is something like:

from numba import jit

@jit
def myfunction(): ...



The core language doesn't have to support these things when there is a 
healthy language ecosystem that can do it.


-- 
Steve




More information about the Python-list mailing list