Python compiler?

Rocco Moretti roccomoretti at netscape.net
Fri Apr 20 20:07:00 EDT 2001


Steve Holden crafted these words:

 
> There's an article on the May edition of DDJ called "Compiling Perl/Tk
> Scripts" by Cameron Laird that might also be useful. The abstract is,
> people want to compile because of 1) speed; 2) code security; 3) size;
> 4) fashion (i.e., just because it's cool); 5) packaging (easier to
> deploy, no separated interpreter installation needed).
> 
> Of all three er.. five, compiling dynamic scripting languages only
> effectively gives us number 4 & 5.
> 
> Steve

I think you may be overstating your case.

The article in question, as it's title suggests, only looked at Perl/Tk
compilers, and only at those on MS-Windows, a sample size of two. It
didn't even mention compilers for any other language, or even any other
platform.

In fact, if you want to be a stickler, you might not even consider them
"compilers." I know nothing about the products, but from the article it
seems that they are equivalent to a "freeze" tool, wrapping the perl
script with a minimal interpreter in a standalone executable.

Thus you get 4) and 5), because you now have a single executable.

You don't get 3) because you have both the script and the interpreter.
(Even though stripped down, it is still sizable.) Heck, for compiling
small C programs you don't get a size benefit due to the loader code and
the included library functions.

Code security (2) is out because the "compiled" programs store the
original perl script as a plaintext string in the executable. (Easily
findable by anyone with a hex editor.) And since you're still interpreting
the program, you aren't going to get a speed advantage (1).

My take on the article is that its directed at clueless IT directors who
see "compiler" in the program's name and think it's a pancea to their
problems. (Perhaps Mr. Laird, who has been seen in this newsgroup, could
clarify, and add his comments on how he thinks Python relates.)

Note that a "true" compiler, which converts the script itself to machine
code and optimizes it, may see benefits in all five points.

If Python will see such a compiler is still an open question.

--
Rocco Moretti






More information about the Python-list mailing list