To begin in D coming from Python

JAnderson ask at me.com
Tue Jul 22 22:40:07 PDT 2008


bearophile wrote:
> JAnderson:
>> ok cheers.  I was just wondering if I should upgrade Lua since its one 
>> of my bottlenecks however I'm using 5.
> 
> Lua is a fast dynamic languages, so if you find bottlenecks in your Lua code you may be doing something wrong (like using Lua for the wrong purpose, etc).
> Anyway, can't you use the JIT? (http://luajit.org/ ), with that Lua becomes very fast :-)
> 
> Bye,
> bearophile

Lua is fast but not as fast as C++ even with the JIT.  If things become 
slow in lua (or any scripting language) the typical solution is to move 
the slow bits over to C++.  Of course then designers can't tweak those 
parts anymore.

Aside from communication bottlenecks between C++ and lua, lua has all 
this extra overhead for allowing things like nil to be safely passed 
around and having objects that can be anything at anytime.  Lua's pretty 
fast for a scripting language.

As far as using it for the wrong purpose; typically I don't like general 
purpose scripting languages at all for game programming but that's just 
me.  However its not my decision to use it.  I like constrained DSL 
languages (that are tool specific) that meet the task and I'm not one to 
do unnecessary work if I don't need to.  I've only come to that 
concussion from seeing the results both approaches applied many times.

The one argument that half makes sense to me is the cost of VS argument, 
however I still think a constrained lib is better.  A few years ago when 
I was using it Lua was so untype safe that I've spend more time fighting 
issues brought up by designers then I think its actually saved.

I think there may be a good use for something like lua in game 
programming however I haven't seen it yet.

-Joel



More information about the Digitalmars-d mailing list