Even Faster
People are wondering what language they choose with Leadwerks3D. Sometimes they have some exotic languages in mind, but quite often it comes down to the decision between Lua and C++.
Recently I read an article that LuaJIT (yes, you can use it in Leadwerks3D too) is actually damn fast. It's fast, because the simpliness of the language allows for extreme optimizations. It might even come close to C++ speed, or in some cases even exceed it. That's how fast LuaJIT 2.0 is. But it's still in beta, so it can only get faster.
Same goes for Fortran 2008 btw, it usually beats the speed of C++, because the compiler knows which CPU registers are in use and can assign them intelligently, which C++ can't, since it doesn't know which registers are in use. But it doesn't have such nicely optimized STL libraries for linked lists and stuff, so it ends up slower in those cases, because nobody can single handed make such great optimizations as STL provides.
Lua has some advantages and also disadvantages over C++.
The advantages are:
1) You can use the same code on all platforms, which makes finishing your game much faster
2) You can develop in real time, because you only need to compile for the final release of the game, if even then, but usually you will need it if your game does some more complex calculations, and to make sure your game runs also well on slower machines
3) You can learn it much faster than C++, it's really just basic, and often even easier than that because there are no types and other annoying stuff
4) You can share code with other people much easier, because like beforementioned, nothing is type specific, which allows for extreme abstraction and generic code
The disadvantages are:
1) You don't have such great arsenal of 3rd party libraries ready for Lua, although with some effort you can find some libraries which someone has made, or you can take any C/C++ library and wrap it yourself for Lua
2) If you really need maximum speed for some time critical routines, you still need C. Yes, not even C++ is fast enough for those. And then you need to wrap them again for Lua
For reference, here is an article that LuaJIT can actually even come on par with C in some benchmarks:
http://lua-users.org...6/msg00071.html
On the other hand, I think with the growing interest for Lua in Leadwerks3D, the Werkspace asset store will provide more and more ready made libraries for Lua over time.
My conclusion is, that LuaJIT 2.0 is a very easy and fast alternative to C++ with Leadwerks3D, and it allows also sharing of code and code snippets much easier than C++ does. Which is what the Leadwerks Community is about.
- 1
21 Comments
Recommended Comments