Doubt on creating threads
sajmikins at gmail.com
Sat Jan 3 19:56:17 CET 2009
On Jan 3, 8:39 am, koranth... at gmail.com wrote:
> I was going through Python posts and this post caught my attentionhttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...
> You have missed an important point. A well designed application does
> neither create so many threads nor processes. The creation of a
> or forking of a process is an expensive operation. You should use a
> of threads or processes.
> I am creating an application and it creates ~1-2 threads every second
> and kill it within 10 seconds. After reading this I am worried. Is
> creating a thread a very costly operation? I cannot use a pool of
> threads because I am using an external application (twisted) to create
> the threads (deferToThread).
Generally you should only worry about this sort of thing if A) you
actually notice a performance problem and B) testing indicates that
it's thread creation which is causing it.
Otherwise you could spend a lot of time working on something that
doesn't actually affect your app's performance.
More information about the Python-list