lua-users home
lua-l archive

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

On Mon, Nov 05, 2001 at 10:16:42AM -0800, Curt Carpenter wrote:
> Can someone point me to some performance comparisons of Lua vs C++?

An interesting point, where the obvious answer is "C++ must be quicker,
right?" -- but a more involved answer could be...

C++ will be faster, when compared with Lua as C++ is compiled to processor
instructions (unless you're using an odd compiler) whereas Lua is compiled
to a VM which is, itself, written in C and therefore compiled into processor

As you can see from the above simple explanation, Lua has at least one more
level of indirection between your source code being written, and the actual
silicon in your computer. Therefore, assuming as much effort went into the
compiler used for your C++ as went into the compiler for your lua VM, and
assuming that your C++ is written as efficiently as Lua (And yes, I know
these are quite large assumptions given your employer's track record) then
one can only be led to surmise that C++ will be an order of magnitude
greater in speed than the equivalent algorithmic implementation in pure Lua.

But, as you are a learned gentleman, I assume that you actually did not mean
performance in the sense of raw computing speed, and in fact have come up
with a more subtle question than I, even in my most close examinations of
the very markup of your original HTML could not divine.

Perhaps you would like to enlighten us all as to what you hoped to gain by
asking such an apparently inane and obvious question? Were you hoping to
catch us out, have you indeed caught me out -- is this all part of a devious
plan to take over the world, or, as I suspect, are you simply a shining
example of why I use Mutt on Linux, and you use Outlook on Windows?

I will admit to knowing of no resource which actually tackles such a
fruitless comparison in any more depth -- my condolences at your lack of
success in your search.

With kind regards, and an honest hope of being proven to be completely wrong,

Daniel Silverstone
Aged 21, No degree nor formal qualification past A-Levels, but, it seems, a
great deal more sense than you Sir.

[If we assume you sent 3 lines of question, you used approx 474 bytes
of bandwidth per line -- even given my lengthy and wordy response, mine
stands at an average of 61 bytes per line even if you count my signature in
full as lines, and the headers of the email purely as content with no line
numbers -- a little more 'efficient' shall we say]

Daniel Silverstone                     
Hostmaster, Webmaster, and Chief Code Wibbler          Digital-Scurf Unlimited
GPG Public key available from            KeyId: 20687895
BOFH excuse #98:

The vendor put the bug there.