Re: JavaVM compiler for Python?

Dan Connolly (connolly@www18.cern.ch)
18 Apr 1995 03:53:59 GMT

In article <CVALE.95Apr17161219@netcom20.netcom.com> cvale@netcom20.netcom.com (Chris Vale) writes:

Dan> e.g, also. Try something like:

Dan> a = {} for i in [0..1000]: a['indx' + `i`] = 'value' +
Dan> `i`

Dan> and watch the heap grow!)

Hmm, don't you mean something like
a = {}
for i in range(0,1000):
a['indx'+str(i)] = 'value'+str(i)
?

this seems to take less than a second to generate, and less than 15k
of heap ( 486DX2 66mz running windows/NT 3.5). So what is the problem?
I think you need to learn a little about the language since your code
isn't correct anyway. The problem is you seem to be assuming something
based on your understanding of the underlying architecture rather than
from practial experience. Try it, you might actually like it.

No... this was from real experience. It has been a little while, so
I'm a little rusty. But we were building a CD-ROM index of the web:
50,000 documents. Just keeping a list of URLs that big made the python
heap exhaust virtual memory. We were forced to switch to perl.

I looked at the source to the runtime, and it does 2 mallocs per
string object: one for the header, and one for the char array.
Considering that strings are immutable, there's an obvious optimization
that's not being exploited (or wasn't in 1.0.3 or 1.1 or so.)

Dan

--
Daniel W. Connolly        "We believe in the interconnectedness of all things"
Research Technical Staff, MIT/W3C
<connolly@w3.org>             http://www.w3.org/hypertext/WWW/People/Connolly