Re: Using luajit runtime for non-lua languages

  • From: David Given <dg@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 06 Feb 2013 10:29:22 +0000

Tim Caswell wrote:
[...]
>     - It's big. When statically linked, it added about 10MB to my
>     executable. In contrast, I'm now statically linking LuaJIT, LevelDB
>     and 11K SLOC of my own C code and it's only 1.5MB. Maybe I did
>     something wrong though because not all tools with LLVM dependencies
>     are this large.

LLVM's llvm-config is, basically, broken and all the options are wrong
--- it seems to assume that you're working *on* LLVM rather than working
*with* LLVM. This means that it will try very hard to statically link LLVM.

I'm using it for a small expression evaluation language and if you link
against the *dynamic* library it's not that bad --- we're talking half
megabyte executables here.

[...]
>     - Users need to have LLVM installed and it takes forever to compile.
>     You can build binaries with LLVM linked in and distribute those. The
>     Julia language does this (http://julialang.org/).
>
> I dont want any external dependencies my users have to install.

The LLVM guys have a rather weird attitude to users and if you're not
building from source they pretty much don't want to know. Which is a
pain. Luckily the people who package it for distributions are a bit more
sensible; if you're on Debian, you can get the LLVM shared library and
header kit with 'apt-get install llvm-3.2-dev'. But yeah, it's not
something you can just take a complete copy of and ship with your
application.

(My language is at http://cowlark.com/calculon if you're interested,
although at time of writing my web server has crashed. I've been quite
pleased with LLVM; code generation was really easy and the entire
language is only 3000 lines of code. I used LLVM rather than LuaJIT
because the language is statically typed and uses vectors extensively,
and because I can get it to give me a raw function pointer I can just
hand to C. However, I suspect LuaJIT would have been a completely viable
alternative, although I haven't done any benchmarks.)

(It occurs to me that it would be... intriguing... to produce a
lookalike API to LLVM's that generates Lua code that gets handed to
LuaJIT...)

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚 𝕽'𝖑𝖞𝖊𝖍
𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓.
│

Attachment: signature.asc
Description: OpenPGP digital signature

Other related posts: