[Python-Dev] tiny optimization in ceval mainloop

Jack Jansen Jack.Jansen@oratrix.com
Sat, 31 Aug 2002 03:39:09 +0200


On vrijdag, augustus 30, 2002, at 10:35 , Tim Peters wrote:

> [Jack Jansen]
>> On vrijdag, augustus 30, 2002, at 06:12 , Tim Peters wrote:
>
> Jack, I'm never on vrijdag -- vrijdag is illegal in the US <wink>.

Oh? Didn't realize that, thought they hadn't gotten any further 
then outlawing
rookdag and drinkdag yet.

>> Some wild ideas:
>> - Use an exponential (or linear?) backoff. If you attempt to
>> switch and nothing happens you double the check interval, up to
>> a maximum. If you do switch you reset to the minimum.
>
> On a pthreads system under 2.3, using semaphores, chances are 
> good it will
> always switch.  But unless you're trying to fake soft realtime, 
> it's a real
> drag on performance to switch so often  We can't out-guess 
> this, because it
> depends on what the *app* wants.  Most apps aren't trying to fake soft
> realtime, so favoring less frequent switches is a good default.

Agreed. But the main application I was thinking of are along the 
lines of one thread
doing real computational work and the others doing GUI stuff or 
serving web-requests
or some such. I.e. while busy you care about response for other 
threads, but you don't
want to spend too many cycles on it.

I remember seeing bad artefacts of having a large value for the 
check interval, such as
bad responsiveness to control-C, but it could well be that this 
was MacPython-OS9
specific.

> You need a model for what it is you're trying [...]

I though you said you didn't have vrijdag?
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -