[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Rotation Performance




Also, since it's probably regular CPython you're running, there's only
ever one thread running at a time.  If you're using threads, you're
probably doing something wrong.


I think what he means is that - don't assume that just because you have 2 threads they will run on both cores.  What you want to do is run multiple processes and do IPC to sync them up and swap data.  In general processes are easier to handle than threads anyway, no shared memory to have race conditions and such about.

You could use multiple threads if it made more sense semantically, but it's not going to give you any speedup.  For the most part, anything that is blocking has an async version as well so there's never really a reason to use threads.

Although if you are using a lot of threads and doing a lot of context switching you might want to check out Stackless Python.  Its threads are much lighter-weight.