lua-users home
lua-l archive

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

On Wed, Mar 16, 2011 at 2:25 AM, Michael Gogins
<> wrote:
> Hate is a matter of personal taste, but if you can moderate your hate
> of C++ I would advise you to.

C(++) Is of course the most high-performance/memory usage solution, if
done right that is*.

Well mostly, I know the JIT developers of various language-JITs can
construct cases, in which a JIT can performs better than a native
compiled application, since it can reoptimize while the application is
running on changing profile data. While this is great JITs can do
this, I consider the examples still to be artificial, overall a well
written native compiled C/C++ real application will still outperform
any scripting language.

However! There are several buts. First is plain and simple development
time, you will get your stuff done faster in a more highlevel
language. Development time costs and CPU/memory costs easily justify
solution up until really large scale (cost and amount of boxes that
can be weaker CPU/RAM). Second is debug time, I have been in a project
where they did write the Web interface in C++. Main argument was,
because the team was all trained in C++ and they feared of the
learning curve/costs to include another language into the spectrum.
This all went backward when we had to spent really a few weeks to find
one bug of a random pointer deference, that unfortunally happened to
taint the stack, causing wieredness much later on. Again if your
project must be C(++), because you are writing a Operating System
kernel, or the engine of a 3D game, it are the effects you will have
to face. If it does not have to be, safe your time, and use a
scripting language or at least a higher intermediary like java or go.

Also to regarding speed, it is easily that many normal projects will
even perform better in a scripting language, since you can much more
easily use better algorithms. I recently converted my project from C
to Lua (and a much smaller C core) (and since then you've me on the
maillinglist :-) At many places where I used linear arrays, just due
to coding economy, the basic algorithmn is now a Hashtable instead
because in Lua you get them for free (or you actually cannot even due
anything that is not a hashtable), that made many O(n) places to O(log
n). Of course I you can hashtable everything also in C, but again the
is a coding economy.

So I would advice again C++ for Web Development, unless you really
have to. Or when the estimated difference in costs of personal
development/maintaining costs really rectify the estimated difference
in saved server operation costs.