Psyco works with QNX6 !!

The ‘Specalization Compiler’ for Python ‘Psyco’ works also with QNX6!!
See the performance tests below …

Python program without Psyco:

def hanoi(n):
han_move(“a”, “c”, “b”, n)

def han_move(frm, to, also, n):
if (n < 2):
return frm, to
else:
return han_move(frm, also, to, n - 1),
han_move(frm, to, also, 1),
han_move(also, to, frm, n - 1)

i = 0
while i<10000:
hanoi (8)
i = i+1

time python hanoi.py

19.10s real 18.92s user 0.00s system
^^^^^

Python program with PSYCO:

#import the specialization compiler
import psyco

def hanoi(n):
han_move(“a”, “c”, “b”, n)

def han_move(frm, to, also, n):
if (n < 2):
return frm, to
else:
return han_move(frm, also, to, n - 1),
han_move(frm, to, also, 1),
han_move(also, to, frm, n - 1)

specialize han_move

psyco.bind(han_move)

i = 0
while i<10000:
hanoi (8)
i = i+1

RESULT:

time python psy_hanoi.py

2.17s real 1.87s user 0.02s system
^^^^
Python + PSYCO is 10 times FASTER ! Its nearly C speed …


Rgards

Armin

Just forgot to mention:

Psyco is available at http://www.sf.net/projects/psyco

Installation:

python setup.py build
python setup.py install

set’s all :slight_smile:

Armin



Armin Steinhoff wrote:

The ‘Specalization Compiler’ for Python ‘Psyco’ works also with QNX6!!
See the performance tests below …

Python program without Psyco:

def hanoi(n):
han_move(“a”, “c”, “b”, n)

def han_move(frm, to, also, n):
if (n < 2):
return frm, to
else:
return han_move(frm, also, to, n - 1),
han_move(frm, to, also, 1),
han_move(also, to, frm, n - 1)

i = 0
while i<10000:
hanoi (8)
i = i+1

time python hanoi.py

19.10s real 18.92s user 0.00s system
^^^^^

Python program with PSYCO:

#import the specialization compiler
import psyco

def hanoi(n):
han_move(“a”, “c”, “b”, n)

def han_move(frm, to, also, n):
if (n < 2):
return frm, to
else:
return han_move(frm, also, to, n - 1),
han_move(frm, to, also, 1),
han_move(also, to, frm, n - 1)

specialize han_move

psyco.bind(han_move)

i = 0
while i<10000:
hanoi (8)
i = i+1

RESULT:

time python psy_hanoi.py

2.17s real 1.87s user 0.02s system
^^^^
Python + PSYCO is 10 times FASTER ! Its nearly C speed …

Rgards

Armin