By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,793 Members | 1,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,793 IT Pros & Developers. It's quick & easy.

psyco out of memory

P: n/a
I have this simple *dumb* benchmark-like program:

#import psyco
#psyco.full()

d = 0.0
for i in xrange(1000000000):
d += i
print d

I though I'd use it to try out psyco, but no, when I enable the first
two lines, python core-dumps:

Fatal Python error: psyco: out of memory
Abort (core dumped)

Now this isn't a real-world application example, but it's certainly
unexpected. Did psyco try to mimic range() and allocate 1G of integers?

(I'm running python 2.3.4 on FreeBSD 5)

--
What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
you understand?
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Ivan Voras <ivoras@__geri.cc.fer.hr> writes:
I have this simple *dumb* benchmark-like program:

#import psyco
#psyco.full()

d = 0.0
for i in xrange(1000000000):
d += i
print d

I though I'd use it to try out psyco, but no, when I enable the first
two lines, python core-dumps:

Fatal Python error: psyco: out of memory
Abort (core dumped)


Hum. Are you using the ivm or the x86 backend?

Also, you might have better luck just using range()...

Cheers,
mwh

--
... but I guess there are some things that are so gross you just have
to forget, or it'll destroy something within you. perl is the first
such thing I have known. -- Erik Naggum, comp.lang.lisp
Jul 18 '05 #2

P: n/a
Michael Hudson wrote:
Fatal Python error: psyco: out of memory
Abort (core dumped)

Hum. Are you using the ivm or the x86 backend?


Don't know. How do I tell?
Also, you might have better luck just using range()...


Tried it. Same thing.

--
What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
you understand?
Jul 18 '05 #3

P: n/a
Ivan Voras wrote:
(I'm running python 2.3.4 on FreeBSD 5)


Hmph. I tried on WinXP and it works. Maybe it's a platform-specific bug.

(Still, I'm surprised how slow it is. The same "program" in Java takes
about 10sec, and here it's passed 5 minutes and I'm still waiting...)

--
What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
you understand?
Jul 18 '05 #4

P: n/a
Ivan Voras wrote:
Ivan Voras wrote:
(I'm running python 2.3.4 on FreeBSD 5)

Hmph. I tried on WinXP and it works. Maybe it's a platform-specific bug.

(Still, I'm surprised how slow it is. The same "program" in Java takes
about 10sec, and here it's passed 5 minutes and I'm still waiting...)


I believe that psyco only accelerates functions and methods. So, it's
not going to do anything in the case you presented. This makes it
particularly suprising that it broke. Try wrapping up your loop in a
function. And with Psyco range is (or at least used to be) better. Like so:

import psyco

def f():
d = 0.0
for i in range(1000000000):
d += i
print d
psyco.bind(f)

f()

That ran in about a minute here. Psyco won't speed up floating point
operations near as much as integer ops at present, hence its speed
deficit with respect to java.

-tim

Jul 18 '05 #5

P: n/a
Michael Hudson wrote:
Ivan Voras <ivoras@__geri.cc.fer.hr> writes:

I have this simple *dumb* benchmark-like program:

#import psyco
It crashes here, right?

I think I know this problem. Armin submitted
a patch concerning memory mapping. Upgrading to
the current cvs version and building by hand should help.
#psyco.full()

d = 0.0
for i in xrange(1000000000):
d += i
print d
You need to wrap this into a function, or you will
not get accelerated.
I though I'd use it to try out psyco, but no, when I enable the first
two lines, python core-dumps:

Fatal Python error: psyco: out of memory
Abort (core dumped)

Hum. Are you using the ivm or the x86 backend?

Also, you might have better luck just using range()...


No, there is no difference using range or xrange, but the
fact that your machine will blow up if Psyco is not in
place and you try to build a range that huge. That's why
I prefer xrange.

ciao - chris
p.s.:
Btw. there has been a bug in Psyco which made the xrange
case slower when using Psyco with Stackless. No Stackless bug,
simply the case that I do a PyType_Ready() on xrange which
standard Python dowsn't, and that inserts a defaul init
function that Psyco did not support (until Wednesday)

--
Christian Tismer :^) <mailto:ti****@stackless.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 mobile +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/

Jul 18 '05 #6

P: n/a
Christian Tismer wrote:
Michael Hudson wrote:
Ivan Voras <ivoras@__geri.cc.fer.hr> writes:

I have this simple *dumb* benchmark-like program:

#import psyco

It crashes here, right?


yes.

--
What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
you understand?
Jul 18 '05 #7

P: n/a
Tim Hochberg wrote:
(Still, I'm surprised how slow it is. The same "program" in Java takes
about 10sec, and here it's passed 5 minutes and I'm still waiting...)


That ran in about a minute here. Psyco won't speed up floating point
operations near as much as integer ops at present, hence its speed
deficit with respect to java.


Yes, it took about minute here too. While it is a ~ 30x speed gain, it
shows there's still space for improvement :)

--
What part of "Ph'nglui mglw'nath Cthulhu R'lyeh wgah'nagl fhtagn" don't
you understand?
Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.