Re: Execution of a program in scripting language?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 10 Feb 2010 16:54:18 +0000 (UTC)

          From comp.compilers

Related articles
Execution of a program in scripting language? pengyu.ut@gmail.com (Peng Yu) (2010-01-18)
Re: Execution of a program in scripting language? dot@dotat.at (Tony Finch) (2010-01-19)
Re: Execution of a program in scripting language? rangsynth@gmail.com (Robin Holmes) (2010-01-20)
Re: Execution of a program in scripting language? cr88192@hotmail.com (BGB / cr88192) (2010-01-21)
Re: Execution of a program in scripting language? arnold@skeeve.com (2010-01-21)
Re: Execution of a program in scripting language? kamalpr@gmail.com (kamal) (2010-02-08)
Re: Execution of a program in scripting language? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-02-10)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 10 Feb 2010 16:54:18 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 10-01-059 10-02-034
Keywords: interpreter
Posted-Date: 10 Feb 2010 12:21:05 EST

kamal <kamalpr@gmail.com> wrote:
(big snip)


> Perl has lots of pre-compiled libraries (as efficient as C) and the
> user-generated compiled perl code isn't exactly inefficient by a huge
> factor. The memory management within perl also requires a lot more
> work at runtime. There are no lists in C to manage, and if you were to
> use STL instead of perl lists -I think you will find it equally slow.


I suppose it depends on what your perl code does, but I have seen
cases where it is slow by a huge factor. About 10 years ago I was
working with some very simple perl code that could read input files at
1 megabyte per minute. Rewriting in C I got one megabyte per second,
so 60 times faster. These were what are called filters in C/unix,
that read data, process it a little, and write out the results. (The
files were from 10s of megabytes to gigabytes.)


When we found that they were slow, we first tried a perl to C
conversion program, but the result turned out to be just as slow. It
seems that the conversion takes the compiled perl code and the perl
code interpereter and writes that out as C source.


Java with JIT doing similar processing, where a large amount of data
is processed in a small loop, is almost as fast as compiled C. It
helps to avoid excessive object creation/destruction inside the
read/write loop. Object-oriented programming encourages that, but it
does slow things down.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.