RE: [Python-Dev] tiny optimization in ceval mainloop
by Tim Peters other posts by this author
Aug 30 2002 8:35PM messages near this date
Re: [Python-Dev] tiny optimization in ceval mainloop
|
Re: [Python-Dev] tiny optimization in ceval mainloop
[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> .
> ...
> And it costs!
>
> Running pystone without another thread active I get 5500
> pystones out of my machine. Running it with another thread
> active (in a sleep(1000)) I get 4200.
> After setcheckinterval(100) I'm back up to 5200.
>
> For completeness' sake: with no other thread active raising
> setcheckinterval() doesn't make a difference (it's in the noise,
> in my measurement it was actually 0.5% slower).
>
> We could get a serious speedup for multithreaded programs if we
> could raise the check interval.
Guido already agreed to try boosting it to 100.
> 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.
> - Combine the above with resetting (to zero? to minimum value if
> currently >= minimum?) the check interval on anything we know
> could influence thread schedule (releasing a lock, etc).
You need a model for what it is you're trying to optimize here. I'm just
trying to cut useless overheads <wink> .
_______________________________________________
Python-Dev mailing list
Python-Dev@[...].org
http://mail.python.org/mailman/listinfo/python-dev
Thread:
Jeremy Hylton
Guido van Rossum
Greg Ewing
Skip Montanaro
Steve Holden
Steve Holden
Jeremy Hylton
Jack Jansen
Tim Peters
Guido van Rossum
Skip Montanaro
Tim Peters
Jack Jansen
Tim Peters
Jack Jansen
Guido van Rossum
Tim Peters
Skip Montanaro
Skip Montanaro
Guido van Rossum
Skip Montanaro
Guido van Rossum
Jeremy Hylton
Guido van Rossum
Tim Peters
|