osdir.com


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

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


On Thu, Mar 8, 2018 at 8:36 AM, Python <python at bladeshadow.org> wrote:
> On Mon, Mar 05, 2018 at 04:09:48PM -0800, Dan Stromberg wrote:
>> On Mon, Mar 5, 2018 at 3:53 PM, Python <python at bladeshadow.org> wrote:
>> > On Sat, Mar 03, 2018 at 08:18:03AM +1100, Chris Angelico wrote:
>> >> > 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.
>> >>
>> >> Have you actually tried it and run into problems,
>> >
>> > Yes.  It was years ago and I forget the details, but I even posted
>> > some sample code here and was told (quite possibly by you) that it was
>> > the GIL that was eating my lunch.  Someone suggested writing the bits
>> > I wanted to thread as a C extension, which largely defeated the
>> > purpose of using Python.  In at least one case I just used C++, and in
>> > another I just ignored the problem until it went away.
>>
>> So how about a little Cython?
>
> Nope.  As a practical matter, the only Python option I have is
> Python proper (i.e. CPython).

So you can use C++, but only if you write the entire program in it,
instead of using Cython and only transforming the part that's actually
slow?

ChrisA