[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does runtime stack work?

From: arnold
Subject: Re: How does runtime stack work?
Date: Sun, 23 May 2021 07:07:23 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Peng Yu <pengyu.ut@gmail.com> wrote:

> > If you have a portable (written in C, C++ or Java) translator T(L1,B)
> > for a language L1 into some bytecode B and a portable interpreter I(B,*)
> > for B on a machine M1, you can compile and execute L1 on M1.
> In this case, the bytecode used by gawk does not have to be private to
> gawk, but it can be a general bytecode?

It could be, in theory, but it isn't. Gawk's bytecode is specific to gawk.

> But python is still much slower than cython. So interpretation could
> have a significant impact on performance.

C Python (the 'python' and 'python3' programs on Linux, for example)
compile to byte code and then interpret that byte code. Those are the .pyc
files you may see after running a python program.  They don't compile
to machine code.

> For gawk, B is directly executed instead of translated to machine code
> for execution?


> Therefore, the current gawk implementation is slower
> than the case when there is a translation to machine code?

Correct.  I don't know that it matters in practice, though, since awk
programs generally do much more I/O than they do computation.  Even in
interpreters, the heavy duty operations, such as record splitting and
regular expression matching, are coded directly in C, and thus execute
in machine code.

There are no compilers from awk to machine code that I know of.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]