Lingo compilation background


[ Zettels Traum ] [ search / suche ]

von dp am 18.Februar 97 um 12:48:58:

zu: Perlen aus dem Strom der Nachrichten im direct_L von Daniel am 22.Dezember 96 um 02:00:59:

> I can't tell if Lingo is "interpreted" or compiled.

Lingo (as of Director 4) is compiled to a low-level pseudocode. That p-code
contains a series of relatively simple instructions that are (in most
cases) similar to native machine code in both spirit and complexity. (They
aren't actually native machine code, though, thus the term "pseudocode".)
The compilation occurs at authoring time, when you hit the recompile button
or save the movie.

At playback time, the compiled p-code is then interpreted by a Lingo
"virtual machine", which figures out to do with each instruction. (The
capabilities of the Lingo virtual machine turn out to be very close to
those of the Java virtual machine. Lingo's is slightly richer, to support
things like dynamic inheritance and the "do" command, but the basics are
more-or-less equivalent.)

Bottom line: I don't want to get caught up in a terminology debate. If you
would describe Java as compiled, then it is fair to call Lingo compiled. If
you consider Java an interpreted language, then you should do the same for
Lingo.

> If Lingo is interpreted then lots of comments
> will affect performance. Does anyone out there know?

Comments are not included in the p-code (there'd be no point), so using
comments won't affect performance. It *will* greatly improve your (and
others') ability to debug your scripts, so by all means use comments
liberally.

Incidentally, questions about Lingo performance are often easy to answer
just by running a simple test. Use Lingo's timer functions to measure the
execution times for several hundred thousand iterations of (in this case) a
handler with lots of comments, and the same handler with no comments.
Compare the results of the two runs, and you'll know which coding style (if
either) performs better.

- Mike Edmunds


Dazu:























D. Plänitz