Re: JavaVM compiler for Python?

Steven Grimm (koreth@spud.Hyperion.COM)
18 Apr 1995 23:19:12 -0700

In <CONNOLLY.95Apr17234941@www18.cern.ch> connolly@www18.cern.ch (Dan Connolly) writes:
>Are you aware that python .py files are compiled to bytecodes (.pyc)
>files the first time they're run? After the first time, the startup
>should be much faster.

Yes, I know that, and in fact I make sure all my Python scripts are byte-
compiled before I do any sort of performance measurement. But unfortunately
the reduction in startup time, while measurable, isn't dramatic. In my
tests it seems to be about 10%. I haven't done any detailed benchmarking,
but I'd guess most of the overhead is starting up the "python" program and
importing all the standard modules I use (which are byte-compiled already,
so compiling my main program doesn't affect their load times.)

Actually, it's not quite true that Python compiles programs to .pyc files
the first time you run them. It only seems to do that the first time you
import them; saying "python foo.py" doesn't create foo.pyc. I have a
makefile to compile my interpreted programs!

Any particular reason you'd like to see Python compiled into JavaVM rather
than a language like C or C++? Seems to me that the latter is perhaps more
generally useful, at least until someone comes up with compilers (macro
assemblers?) to translate JavaVM to native executables. Or are you aiming
at writing applets for HotJava in Python?

-Steve