Why Not Translate Perl to C

Levente Sandor nospam at newsranger.com
Sat Jun 30 09:52:50 EDT 2001


In article <mailman.993895305.13072.python-list at python.org>, Oleg Broytmann
says...
>   This is about Perl, but it applies to Python as well. And of course not
>only to C, but to native code too.
>
>http://www.perl.com/pub/a/2001/06/27/ctoperl.html
>
>   "A C program to do what your Perl program does would have to do most of
>the same things that the Perl interpreter does when it runs your Perl
>program. There is no reason to think that the C program could do those
>things faster than the Perl interpreter does them, because the Perl
>interpreter itself is written in very fast C."
>

I think there is a very serious reason to think that. Of course, calling a C
function from an interpreted language isn't significantly slower than doing the
same thing in machine code. But just compare some "pure" Python functions or
loops to their C equivalents.

"4.7 cStringIO -- Faster version of StringIO
The module cStringIO provides an interface similar to that of the StringIO
module. Heavy use of StringIO.StringIO objects can be made more efficient by
using the function StringIO() from this module instead."
(From the Python Library reference)

Levi





More information about the Python-list mailing list