python vs. java, slight reprise (from sun, no less)

holger krekel pyth at devel.trillke.net
Sun Feb 9 11:43:43 EST 2003


Alex Martelli wrote:
> holger krekel wrote:
>    ...
> >> connections and native interfaces. The key difference is that Python
> >> is a scripting language. This means there is no compilation to byte
> >> code so the Python runtime environment has to do two things in
> >> addition to what the Java runtime environment does.
> > 
> > Well, that disqualifies the survey quite a bit.
> 
> I took it as only a slightly-sloppy expression, which could be
> rephrased as: "there is no NECESSARY compilation to byte code
> [before the "Python runtime environment" executable or DLL gets
> the code] and therefore said PyRE must also include code that is
> able to do two things in addition to what the JRE does".

Sure, I was a bit too fast judging it.  You have to employ
some selection algorithms these days and the above first paragraph
rang some bells :-)

> I.e.: it's weird that the PyRE is indeed smaller than the JRE,
> because the PyRE, besides the PyVM, *must* include extra stuff,
> the compiler, as well: such extra stuff must be around because
> the main script is not saved to disk in bytecode form, AND also
> because Python guarantees that the .pyc or .pyo files will be
> regenerated if the .py source is also around, and never (also,
> a .py source could be on a read-only part of the disk -- and
> then, again, the PyRE must in general be able to parse that
> source and generate the bytecode each time, on the fly).

true.

> You could presumably build a smaller specialised PyRE that
> can only work on pregenerated bytecode, but the comparison
> the memo is making is not with such a specialized PyRE, but
> rather with the actual one in the standard distribution.

Do you (or someone else) know what exactly a modern JRE includes?  
I guess they have a lot of JIT-technologies running which usually
require lots of memory.  
 
> >> Given this data, it appears that the JRE can actually be simpler than
> >> the Python RE since Java does at least some of this work at compile
> >> time.
> > 
> > In fact, Python's VM is simpler.
> 
> I think you're right here, but also that (due to the slight
> sloppiness I tried to clarify above) you might be missing the
> point.  The memo wants to raise alarm that the JRE is so big
> DESPITE advantages in its specs (it has fewer things is must
> be able to do, compared with the PyRE) which would appear to
> be sufficient to allow it to be smaller.

right.

> >> from http://www.internalmemos.com/memos/memodetails.php?memo_id=1321
> >> 
> >> which is a great read for old pythonistas and javabashers like I am ;)
> > 
> > I doubt it (without bothering to read it because of the above
> > obvious errors), sorry.
> 
> I think you may want to forgive that sloppiness and read the
> memo anyway; it IS interesting, despite that slight failing.

Yip, i read it now and it makes more sense than i suspected.  Though 
the authors are a bit misguided regarding how cleanly lexing, parsing, 
compiling and execution is separated with Python.  But for people who are
arguing Java versus Python the above link is helpful to show around. 

regards,

    holger





More information about the Python-list mailing list