472,982 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

Trouble with psyco

psyco is acting a bit psycho for me.

Please see my spinForWeb.py at <http://www.rcblue.com/Python/spinForWeb.py>

When psyco is in use, entering an integer somewhere between 2000 and 2500
causes my computer to freeze. Not really freeze but the program doesn't
finish, and I have to quit with a ^Q.

psyco is really impressive, but I'm disappointed that I can't demonstrate
(to friends) counting with it to numbers above 2 billion.

If I remark out the "psyco.bind(spin)" line, there's no problem no matter
what integer I enter. Can someone explain what the problem with psyco is?

Windows XP, Python 2.3.4

Thanks,

Dick Moores
rd*@rcblue.com

Jul 18 '05 #1
3 1615
On Mon, 22 Nov 2004 02:07:46 -0800, Dick Moores <rd*@rcblue.com> wrote:
psyco is acting a bit psycho for me.

Please see my spinForWeb.py at <http://www.rcblue.com/Python/spinForWeb.py>

When psyco is in use, entering an integer somewhere between 2000 and 2500
causes my computer to freeze. Not really freeze but the program doesn't
finish, and I have to quit with a ^Q.

psyco is really impressive, but I'm disappointed that I can't demonstrate
(to friends) counting with it to numbers above 2 billion.

If I remark out the "psyco.bind(spin)" line, there's no problem no matter
what integer I enter. Can someone explain what the problem with psyco is?
It seems like a problem with your python code. If you enter 2200 :
max = raw_input("positive integer: ") # "2200"
millions = int(max) # to use for printing result # 2200
max = int(max) * 1000000 # not possible on a 32bits platform
# as it is greater than sys.maxint
So please write : max = int(max) * 1000000L
and choose another name (vmax for instance) which doesn't hide a
builtin. And likewise initialize k as k = 0L

Thanks,

Dick Moores
rd*@rcblue.com

Jul 18 '05 #2
Dick Moores wrote:
psyco is acting a bit psycho for me.

Please see my spinForWeb.py at <http://www.rcblue.com/Python/spinForWeb.py>

When psyco is in use, entering an integer somewhere between 2000 and
2500 causes my computer to freeze. Not really freeze but the program
doesn't finish, and I have to quit with a ^Q.

psyco is really impressive, but I'm disappointed that I can't
demonstrate (to friends) counting with it to numbers above 2 billion.

If I remark out the "psyco.bind(spin)" line, there's no problem no
matter what integer I enter. Can someone explain what the problem with
psyco is?

Windows XP, Python 2.3.4

Thanks,

Dick Moores
rd*@rcblue.com

$ python -c "print 2**31"
2147483648

[Please note this is all theory, as I'm not a psyco user]

You are hitting the limit of your platform's integers. After that Python
(and, presumably, psyco) starts using longs, which will be considerably
slower.

In plain Python you probably notice the difference much less, because
there is less difference between integer ops and long ops when no
optimization is applied. I presume that psyco (stealing a phrase from
Tim Peters) "optimizes the snot" out of the integer operations, and the
transition to longs then becomes much more noticeable.

The alternatives are to use a platform with 64-bit integers or stop
trying to deal with large integers.

I should thank you for the post, as the statement above about my not
being a psyco user is no longer true. To test the theory I actually
installed psyco, and verified that your figure of 2000 isn't accurate -
an input of 2100 could be processed by the psyco-optimized version in
9.834 seconds on my machine. An input of 2200 took longer than I cared
to wait, which I regard as strong evidence that it's crossing the
integer/long boundary that's biting you.

Given that without psyco it took me almost 41 seconds to process an
input of 100, I think you should be grateful for what you've got ;-)

regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #3
Dick Moores wrote:
psyco is acting a bit psycho for me.

Please see my spinForWeb.py at <http://www.rcblue.com/Python/spinForWeb.py>

When psyco is in use, entering an integer somewhere between 2000 and
2500 causes my computer to freeze. Not really freeze but the program
doesn't finish, and I have to quit with a ^Q.

psyco is really impressive, but I'm disappointed that I can't
demonstrate (to friends) counting with it to numbers above 2 billion.
"My car is really great when I use ethanol as the fuel, but I'm
disappoointed it won't go at 1,000 miles an hour".
If I remark out the "psyco.bind(spin)" line, there's no problem no
matter what integer I enter. Can someone explain what the problem with
psyco is?

[...]
One other comment - I'll bet the only reason you don't notice the same
problem without psyco is that you never took the time to try to count
large ranges! I can guarantee you'll see the same performance break.

regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KefX | last post by:
Hey...as for what I'm doing with Python, look at my post "Strange Hotshot problem". To make a long story short, I'm embedding Python in order to write a plugin to a freeware music program; the...
10
by: William S. Perrin | last post by:
I'm a python rookie, anyone have and suggestions to streamline this function? Thanks in advance..... def getdata(myurl): sock = urllib.urlopen(myurl) xmlSrc = sock.read() sock.close() ...
0
by: Jeremy Sanders | last post by:
Hi - I'm trying to build a Psyco rpm on Fedora 1. I try the command xpc5:~/psyco-1.1.1> python setup.py bdist_rpm this fails with: .... copying dist/psyco-1.1.1.tar.gz ->...
7
by: Ivan Voras | last post by:
I have this simple *dumb* benchmark-like program: #import psyco #psyco.full() d = 0.0 for i in xrange(1000000000): d += i print d
2
by: Paulo da Silva | last post by:
When running the following program: #! /bin/env python # -*- coding: iso-8859-15 -*- import psyco psyco.full() def main(): n=eval("123+456")
5
by: Fausto Arinos Barbuto | last post by:
Hi All; I have Psyco (on Windows XP) and now I want to install it on Linux, too. I FTP'd the tarball (tar.gz) from Psyco's site but can't get it compiled. First, I tried the usual "python...
6
by: danmcleran | last post by:
I'm not seeing much benefit from psyco (only 5-10% faster). Maybe this example is too trivial? Can someone give me some pointers as to what kind of code would see a dramatic benefit? Here's the...
3
by: a | last post by:
hi i tried psyco+webpy here is the error that i got please let me know if any of you has success run psyco+webpy thanks import web, psyco urls = ( '/', 'view', '/add','add'
15
by: Steve Bergman | last post by:
Just wanted to report a delightful little surprise while experimenting with psyco. The program below performs astonoshingly well with psyco. It finds all the prime numbers < 10,000,000 ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.