Lua, Java, Javascript or C...
Hi all,
I'm working on a patch in which I can create some Jitter Gridshapes and let them float in the space. I managed to do that in Lua, but I want to add some extra's and that will mean the program will become much heavier. My question is; which language is the best for this situation?
I know that Java is much faster than Javascript, and that C is even faster. But I have no idea about Lua.
I will need to calculate position and rotation of each object at around 25x per second. Should I stay in Lua, or write something in Java or C and pass the data to a Lua script controlling the objects?
Thanks!
Lua is an interpreted language, isn't it? That would put it in the JScript ballpark.
I'm sure Lua's developers will argue that it's much faster than JScript, maybe it is. They'd need to pull a couple of rabbits out of a hat to get an interpreted language as fast as Java (though not entirely inconceivable to get close). An external in C is pretty much unbeatable, although you do have to factor in how much work you need to get a C-based external up and running.
I don't now if it is.. So if I write an external in C to calculate the positions etc, and then pass it to a Lua script, it will be faster and more lightweight using Lua only? (It's a good reason to start writing in C... ;) )
There is some overhead every time you cross a "boundary" between Max and another language. I know it's pretty high for Java and JavaScript. I don't about Lua, but I doubt it comes for free.
(C-based externals are an exception in that the only "overhead" is the basic Max message-passing stuff.)