High Performance Software with C, Lua

There are no two ways about it if you want to develop high performance software that runs fast and lean you have to code it close to the machine. This usually means writing it in C or C++.

While C or C++ are good for writing interfacing to hardware, number crunching, or graphics processing, developing the scaffolding that you need for your program becomes tedious and slow in C/C++. It is easier and faster to write such scaffolding in Lua.

Consider for example that you are writing a number crunching program that needs to be initialized with some user input. If you are using C/C++, you will have to write your own routines to parse the data. If you embed Lua, the configuration files can be simple Lua programs that are automatically parsed by the embedded Lua interpreter.

Lua has a number of advantages

  • Lua is small, the core interpreter can be cut down to few tens of kilo bytes
  • Lua is multi thread safe
  • you can use Lua to make your application scriptable
  • there is a Just In Time (JIT) compiler LuaJIT available for Lua for x86 platforms
  • Lua depends only on ANSI C compiler and runs on all kinds of platforms even those with no OS. It can be ported to microcontrollers with a couple of hundred kiliobytes of Flash. This means that you can use Lua as a scripting language for embedded systems based on high end microcontrollers
  • Lua is extremely easy to interface with C/C++
  • Lua is stable
  • Lua's implementation is small, simple and coherent. You can understand the implementation and maintain it.

You don't get an easy to use GUI interface by default with Lua. This is one advantage that an easy to use language like PureBasic has over Lua. However PureBasic generates programs for an x86 class machine with Windows, Linux or Mac OS to run. However Lua has bindings with the wxWidgets, Qt and other GUI widget sets that can be used to generate user interfaces for devices ranging from touch screen devices to PC class machines.

Return to top of High Performance Software with C, Lua

Need More Help? Have An Opinion?

Do you need more help to solve your problem? Would you like to ask the author a question about your specific problem? Do you have a great idea about this?

We will post an answer within 2 business days. If you need more immediate assistance or you would like to discuss your issue privately, please use our contact us form or call us at 1-888-215-8557. We love solving technical issues and there is no charge if we solve your problem over email or over a short phone call.

[ ? ]

Author Information (optional)

To receive credit as the author, enter your information below.

(first or full name)

(e.g., City, State, Country)

Submit Your Contribution

  •  submission guidelines.

(You can preview and edit on the next page)