lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

As far as I undestand JIT optimization gives better results than any
sort of static code optimization [1]. This is, JIT can outperform any
optimization done by any compiler statically.

So if you're seeking a gain in performance by compiling lua to C then
you should reconsider using a JIT instead.

Cheers,
Antonio

[1] http://stackoverflow.com/questions/538056/jit-compiler-vs-offline-compilers

2010/5/25 Javier Guerra Giraldez <javier@guerrag.com>:
> On Mon, May 24, 2010 at 3:16 AM, Patrick
> <spell_gooder_now@spellingbeewinnars.org> wrote:
>> I can program in a few dynamic languages but the only compiled one I know is
>> C.
>>
>> C is perfect in several ways, it can run on "bare metal", it's small and
>> fast but I can't transfer several useful concepts from Lua back to C. Simple
>> code like this seems problematic to me in C:
>> SomeTable= {Lua = "fun", a = 1, b = 2, c = 1 + 2}
>
> this kind of things can be expressed in C by using a library.  after
> all, most of standard C is in fact just the standard library.
>
> i'm sure there are lots of good libraries for this; but one i find
> particularly easy to understand is Lua itself.  even if in some part
> of your C code don't use Lua code, you can still create a Lua state
> and fill it with your own tables, all handled with C code.
>
>> Is there another complied language that is similar to Lua?
>
> i think there's somewhere a Lua2c 'compiler', that turns Lua bytecode
> into the equivalent C code that does the same by using Lua API calls.
> the speed gains aren't important (and i think LuaJIT is far, far,
> better than that); but it can be closer to what you're looking for.
>
>
> --
> Javier
>