lua-users home
lua-l archive

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

I'd like to make a minor comment about benchmarking of languages.  Adolf
Mathias wrote:

> All Schemes/Lisps I know as well as Perl (including Emacs-Lisp
> which is reputedly very fast) are behind by a factor of at least
> 3 to 4. Worst is Tcl. I haven't checked any Forths, but most
> Forths don't have the notion of an object with dynamic (run-time)
> type description, which Lua as well as Ghostscript (the most
> Forth-like of all) has. Instead, you have to mess around with
> machine words in Forth and decide whether you want to interpret
> that DWORD as an integer, a float, or a pointer.  So I would
> expect that there is not much around that might beat Lua.

It seems strange to benchmark Ghostscript which is an application-specific
language against more general-purpose languages.  A lot of Ghostscript is
geared towards image description-- and it is optimized for that task.  And
while Ghostscript resembles elements of Forth, most Forth fans see
Ghostscript (and Postscript) as an entirely separate thing.

If anyone does attempt to benchmark Forth for this discussion, it is
necessary to state explicitly *which* Forth is being benchmarked.  That's
because there is no standard implementation model for Forth.  There are
Forth implementations that use a variety of threaded code, other Forths
that compile to native code, Forths that compile to opcodes in a virtual
machine, and so on.  The sheer variety of implementation models for Forth
is what has led to the joke, "if you've seen one Forth, then... well...
you've seen one Forth."

although Forth's stack is untyped, it is possible to extend the Forth
language to deal with types.  Additionally, there are several different
object models one can add to Forth, depending on need.  The nice thing
about Forth is that the primitives are exposed, and they can be changed,
allowing for great extensibility.

Although the underlying mechanisms are different, it wouldn't surprise me
if the Lua folk weren't (in part) influenced by Forth's extensibility in
the design of their language.

There are many reasons why Lua is a great scripting and extension
language-- not just for game developers, but other domains too.  Sorry to
derail this discussion with one of Forth, but I thought it was important to
make these statements before people use them to justify the use of Lua over
other languages.  Every language has its place (or else it wouldn't exist).
You'll note for example that Lua isn't implemented in Lua...  8-)