OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


On Mon, Feb 26, 2018 at 09:57:06AM +0000, Steven D'Aprano wrote:
> Besides, if you want Python with no GIL so you can run threaded code, why 
> aren't you using IronPython or Jython?

But this is just another oversimplified argument.  In the real world
there rather often exist constraints which have nothing to do with
what is technically possible, but which make impractical or infeasible
what may be technically possible.

Python is often a preferred solution because it is often fantastic for
rapid implementation and maintainability.  The GIL's interference
with threaded code performance has, for me at least, on several
occasions been...  disappointing (perf costs of removing it aside)
because it gets in the way of choosing Python for such solutions.
Jython and IronPython are simply not feasible options for me, for
multiple reasons that have zero to do with their technical
suitability.

But back to the point of the thread, I think it's ironic that you're
basically making the benchmarks' argument:  Choose the tool which
suits the solution you need.  You argue we should use IronPython or
Jython when threads are needed, and the Julia benchmarks *imply* (but
never actually argue, AFAICT) that if you need a solution which relies
on heavy use of function calls, since Python will be slower than Julia,
you should therefore choose Julia instead.  But that's only a sensible
conclusion if all other things be equal, which of course they are not,
neither for Julia vs. Python, nor for Python vs. Jython or IronPython
(though likely the latter case is slightly closer to being true).