Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3989

Re: About threads in python

From Hans Georg Schaathun <hg@schaathun.net>
Newsgroups comp.lang.python
Subject Re: About threads in python
Date 2011-04-25 20:31 +0100
Organization University of Bergen
Message-ID <fpug88-0tt.ln1@svn.schaathun.net> (permalink)
References <47d21fd4-22d3-4ee0-bdc2-a3643af4fc9e@t16g2000vbi.googlegroups.com> <d57ebeb4-fa90-42d7-a608-0d2621667016@bl1g2000vbb.googlegroups.com>

Show all headers | View raw


On Fri, 22 Apr 2011 12:19:56 -0700 (PDT), sturlamolden
  <sturlamolden@yahoo.no> wrote:
:  To optimise computational code, notice that Python itself
:  gives you a 200x performance penalty. That is much more
:  important than not using all 4 cores on a quadcore processor.
:  In this case, start by identifying bottlenecks using the
:  profiler. Then apply C libraries or these or rewrite to Cython.
:  If that is not sufficient, you can start to think about using
:  more hardware (e.g. multithreading in C or Cython). This advice
:  only applies to computational code though.

And not necessarily even there.  The extra programmers to recode
in C come with more than a 200x cost factor.  It is almost trivial
to make a multithread map implementation which could have exploited
umpteen core box were it not for GIL.  That would be a cheap gain.
It matters little that you could gain 100x more at 200x cost ...
Besides, the bottleneck is likely to be deeply embedded in some
library like numpy or scipy already.

-- 
:-- Hans Georg

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

About threads in python dutche <dutche@gmail.com> - 2011-04-21 06:19 -0700
  Re: About threads in python Stefan Behnel <stefan_ml@behnel.de> - 2011-04-21 16:09 +0200
  Re: About threads in python sturlamolden <sturlamolden@yahoo.no> - 2011-04-22 12:19 -0700
    Re: About threads in python Hans Georg Schaathun <hg@schaathun.net> - 2011-04-25 20:31 +0100

csiph-web