RE: [Python-Dev] tiny optimization in ceval mainloop
by Tim Peters other posts by this author
Aug 30 2002 4:12PM messages near this date
Re: [Python-Dev] tiny optimization in ceval mainloop
|
Re: [Python-Dev] tiny optimization in ceval mainloop
[Skip Montanaro]
> ...
> My guess is that the code is avoiding a lot of pointer dereferences.
> Oh, wait a minute. I muffed a bit. I initialized the ticker and
> checkinterval variables to 100. Should have been 10.
Someone <wink> may wish to question the historical 10 too. A few weeks ago
on c.l.py, a number of programs were posted showing that, on Linux, the
thread scheduling is such the the *offer* to switch threads every 10
bytecodes was usually declined: the thread that got the GIL was
overwhelmingly most often the thread that released it, so that the whole
dance was overwhelmingly most often pure overhead. This may be different
under 2.3, where the pthreads GIL is implemented via a semaphore rather than
a condvar. But in that case, actually switching threads every 10 bytecodes
is an awful lot of thread switching (10 bytecodes don't take as long as they
used to <wink> ).
I don't know how to pick a good "one size fits all" value, but suspect 10 is
"clearly too small". In app after app, people who discover
sys.setcheckinterval() discover soon after that performance improves if they
increase it.
_______________________________________________
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
|