[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Crazy idea: compiling C to Lua
- From: David Given <dg@...>
- Date: Wed, 13 Mar 2013 11:54:00 +0000
Nikolay Zapolnov wrote:
[...]
> Maybe this is not exactly what you want, but there is a CLUE:
> http://cluecc.sourceforge.net/
>
> It can compile C to Lua, Python, Perl, Java and Javascript.
>
> The project seems abandoned, but it can help to understand how the
> translation could be made.
Not quite. I was finally prodded into getting it working again just the
other day, and I updated the Lua backend so that it uses the new Lua 5.2
goto statement. (It's not checked in yet.) Here are the new results of
running the whetstone benchmark:
gcc directly: 2582
clue -> LuaJIT: 2482
clue -> C -> gcc: 2361
clue -> Java: 784
clue -> Javascript: 105
clue -> Perl: 2.7
The top one is what you get if you compile the benchmark directly with
gcc. I'm afraid I don't have a Lua interpreter value because I don't
have a luasocket for Debian Lua 5.2 yet. The Javascript interpreter is V8.
That's all very preliminary and may in fact be wrong --- it's all work
in progress. Assuming the results are correct, the LuaJIT score is
remarkable. Adding some more LuaJIT-specific optimisations --- using FFI
types, for example --- ought to speed it up some more.
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚 𝕽'𝖑𝖞𝖊𝖍
𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓.
│
Attachment:
signature.asc
Description: OpenPGP digital signature