peter at engcorp.com
Mon Jul 21 04:33:19 CEST 2003
Anand Pillai wrote:
> Set the interpreter's ``check interval''. This integer value
> I am interested in the last but one statement which says, "Setting it
> to a larger value may increase performance for programs using
> threads.". So my question is what would that value be? How can I find
> out the number of python 'virtual instructions' for every function I have?
Do you really want to waste time optimizing at such a level? I suspect
it's very unlikely you will notice any difference other than with
order-of-magnitude changes. In other words, it's normally every 10
instructions, but if you change it to 100 or 1000 you could notice a
difference. (Zope sets the checkinterval to 120 (in the version I checked),
but I think I'd be surprised if 100 or 140 turned out much different.
Trying to "tune" it to, say 27, or 73, or something would be sheer insanity.
If you need better performance than what you are getting, find your
bottlenecks by profiling and optimize there, or write a C extension,
or use Pyrex, or Psycho or something.
(To find the number of bytecode instructions, use module "dis", BTW.)
More information about the Python-list