Python and the need for speed

Paul Rubin no.email at nospam.invalid
Wed Apr 12 01:26:49 EDT 2017


Chris Angelico <rosuav at gmail.com> writes:
> It's also entirely possible to have a single "application thread" and
> then a "file opening thread" that does nothing but open files;

Thanks.  I think GHC and Erlang BEAM both do that.  I hoped there was a
better way.  Note you potentially need multiple file opening threads.

> your app is still single threaded (thus you don't have concurrency
> concerns), but file opening becomes truly asynchronous.

Of course you still have concurrency concerns, plus you have to be very
very careful that nothing ever blocks.  I've generally preferred in
Python to use threads communicating by message passing through queues.
This is pretty safe if you remember to not having any mutable objects
shared between threads.  Of course I like the way Erlang does it even
more, with isolated lightweight processes.

> Oh, and Python also has to cope with a bit more complexity because
> it's possible to start multiple application threads in Python. It's
> not in JS.

Yeah I'm not sure of the JS situation.  C++11 has futures and promises
and I've been wanting to try to use them, but it's still on my
infinitely deep stack of stuff to do.  This looks amazing though:

  http://www.seastar-project.org/


More information about the Python-list mailing list