What psyco is goot at [Was: Rookie Speaks]

Samuel Walters swalters_usenet at yahoo.com
Thu Jan 8 19:00:12 EST 2004


|Thus Spake Tim Churches On the now historical date of Fri, 09 Jan 2004
09:10:58 +1100|

> Does that mean that Armin Rigo has slipped some form of Einsteinian,
> relativistic compiler into Psyco?

No, no.  It means one of two things:  either you didn't adjust constant
that tries to factor out the overhead of profiling, or the call took so
long that the timer actually overflowed.

This will help you set the proper constant:

-----
import profile
import pprint

tests = 20
cycles = 10000
pr = profile.Profile()
proflist = []
for x in xrange(1, tests + 1):
    proflist.append(pr.calibrate(cycles))

pprint.pprint(proflist)
-----

Increase cycles until your results don't exhibit much of a spread, then
take the lowest of those values.  This is the constant you set when
instantiating a profiling object.  It is specific to each individual
machine.

If it *still* gives you negative times, then the timer is overflowing and
you need to adjust the original script so that you're not running through
such a big list of numbers.

Then your apparent problems with causality should be solved.

Sam Walters.

-- 
Never forget the halloween documents.
http://www.opensource.org/halloween/
""" Where will Microsoft try to drag you today?
    Do you really want to go there?"""




More information about the Python-list mailing list