Psyco testing feed-back wanted

Ian Holmes ianholmes01 at lycos.com
Thu Sep 5 13:54:18 CEST 2002


"Jimmy Retzlaff" <jimmy at retzlaff.com> wrote in message news:<mailman.1030139622.888.python-list at python.org>...
> Wow!!!
> 
> I've seen raves about Psyco, but I hadn't tried it myself until today.
> My test case was a function that tests if a point is in a polygon. I
> timed several runs with different approaches. All tests are whether 1
> point is in a polygon made up of 5,000,000 points. The timing was done
> on just the function call itself. Here are some results:
>

I had never heard of it before reading the "Python to exceed C in
2030" thread but as soon as it was mentioned I had to test it :)

I saw 3-5x speed increases on a big list / for loop (test data only)
that ran for 8s without psyco.

top product - code used as follows (fairly trivial I admit)
----
import string,time,random,psyco
from strings import * #imports a list of 4 strings

LOOPS = 100000

def method_one(body, x):
    for a in range(0, LOOPS):
        body.append(strings[x])
        x = random.randint(0,3)
    return body

print "Starting test one"
body = []
x = 0
START_TIME = time.time()
text = string.join(method_one(body,x))
print "append method (list) =>", time.time()-START_TIME,"s"
strlen = len(text)
string_size = strlen / 1024
print "Size is",string_size,"KB"

print 'starting psyco'
meth1 = psyco.proxy(method_one)

print "Starting test Two"
body = []
x = 0
START_TIME = time.time()
text = string.join(meth1(body,x))
print "append method (list) =>", time.time()-START_TIME,"s"
strlen = len(text)
string_size = strlen / 1024
print "Size is",string_size,"KB"



More information about the Python-list mailing list