Murga-Projects Forums
Tcc - Lua - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Tcc - Lua (/showthread.php?tid=361)

Tcc - Lua - jpjacobs - 01-15-2009 11:36 PM

Hi, since the exam-period is usually the period where anything is interesting, here another blurb.

I was thinking about the biggest disadvantage of interpreted languages like Lua is the speed. So I wrote a little test to compare a C routine passed from within Lua to tcc and have it run directly, and the same routine implemented in Lua directly.

It turns out that the tcc version is a whopping 16 times faster than the Lua version, so maybe it's of some use to people who need to write fast code for some tasks.
Another good thing about Tcc is that it should compile for all 3 platforms supported by MurgaLua (disclaimer: not tested myself), and it's really small (installed size on debian 446k).

Anyway, the simple testscript I used is here.
Hope it's of some use to anyone!


RE: Tcc - Lua - jyf1987 - 01-16-2009 11:56 PM

i am interesting of tcc too,but when i meet some problem and i sent mail to the dev-maillist,they tell me they just treat it as a toy,and hope i choose gcc as a offical compiler

RE: Tcc - Lua - jpjacobs - 01-16-2009 11:59 PM

That's a real pitty, because such a small c compiler, even with it limitations compared to its big brother gcc, is really interesting I think...

RE: Tcc - Lua - jyf1987 - 01-17-2009 04:30 PM

yes,i think tcc is an very helpful tool for me,because i have no more lua was written by clean C,maybe tcc is a good tool for writting addons for lua interpreter

RE: Tcc - Lua - znarf - 01-23-2009 06:42 AM

I'm also a big fan of tcc and even use it sometimes productively at work for small tasks - I'm not aware of an alternative if you need a working portable compiler on a memory stick.
If your main concern is execution speed, did you already have a look at luaJIT? In the one case I tried it, it gave me a performance boost of a factor 7. Then the difference to tcc executables (which are not very optimized machine code) is not that large any more, and to my mind the advantage of staying within one language (think about debugging!) in most cases clearly outweighs the gain in speed.