mir VS LuaJIT

Compare mir vs LuaJIT and see what are their differences.


A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR (by vnmakarov)


Mirror of the LuaJIT git repository (by LuaJIT)
Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Zigi - Close all those tabs. Zigi will handle your updates.
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Scout APM - Truly a developer’s best friend
mir LuaJIT
14 29
1,671 3,544
- 2.9%
7.9 8.3
15 days ago 3 days ago
MIT License GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of mir. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-08-17.


Posts with mentions or reviews of LuaJIT. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-22.
  • Building the fastest Lua interpreter.. automatically
    8 projects | news.ycombinator.com | 22 Nov 2022
    This seems like an awesome way of writing faster interpreters – i.e. not in assembly, but in C++ snippets you stitch together with a tool.

    I did peek at the deegen tool a bit, and it seems quite large? https://github.com/luajit-remake/luajit-remake/tree/master/d...

    I would be interested in an overview of all the analysis it has to do, which as I understand is basically “automated Mike Pall”

    FWIW I think this is the hand-written equivalent with LuaJIT’s dynasm tool: https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/vm_x64.dasc (just under 5000 lines)

    Also there are several of these files with no apparent sharing, as you would get with deegen:



  • Zuo: A Tiny Racket for Scripting
    4 projects | news.ycombinator.com | 11 Nov 2022
  • Vim Minimalist
    2 projects | reddit.com/r/programming | 15 Oct 2022
    Note: this post is not related to the LuaJIT project, which lives at https://luajit.org. luajit.io, the domain of this post, is a personal blog.
  • Apache APISIX loves Rust! (and me too)
    7 projects | dev.to | 27 Sep 2022
    OpenResty, a platform that allows scripting NGINX with the Lua programming language via LuaJIT
  • Using Lua scripts with C++
    2 projects | reddit.com/r/gamedev | 12 Aug 2022
    Lua is perfectly capable for providing scripting support, both to support mods, or to write gameplay logic. Because of that, it's used in plenty many places. The core engine code can be C/C++, and this is what something like Love2D does, for example. For performance, you can use LuaJIT, if vanilla lua doesn't do it for you.
  • Luajit is almost stop development, what will be neovim’s future?
    2 projects | reddit.com/r/neovim | 17 Mar 2022
    Development has not stopped at all. What gave you that idea?
  • What's the state of LuaJIT these days?
    3 projects | reddit.com/r/lua | 29 Jan 2022
    The LuaJIT website basically still says it's specced for 5.1, but the GitHub shows several open and closed Issues relating to various 5.2, 5.3, 5.4 things. I assume individual features are just being ported as-needed by contributors? Is there anywhere I can find a list (needn't be comprehensive) about the key features that are/aren't supported?
  • MiniVM: A minimal cross-language runtime that beats C/luajit on some benchmarks
    10 projects | news.ycombinator.com | 8 Jan 2022
    Out of curiosity, are you planning on (progressively, slowly) rolling your own JIT, or using something like DynASM (https://luajit.org/dynasm_features.html), libFirm (https://pp.ipd.kit.edu/firm/Features.html), or some other preexisting thing (eg https://github.com/wdv4758h/awesome-jit) in the space?

    FWIW, I understand that LuaJIT gets some of its insane real-world performance from a JIT and VM design that's effectively shrink-wrapped around Lua semantics/intrinsics - it's not general-purpose. I've read (unfortunately don't remember exactly where) that people have tried to run off with the JIT and VM and use it in other projects, but never succeeded because of the tight coupling.

    In the same way, while a bespoke 64/32-bit x86+ARM JIT would be a reasonable undertaking, it could make for a pretty interesting target with a potentially wide-ranging set of uses.

    For example, it could be the VM+JIT combination that all those people dissecting LuaJIT were looking for :).

    I could see something like this becoming an attractive option for games that want an exceptionally simple runtime. Sort of like a scaled-down NekoVM (nee Haxe).

    Broadly speaking, I get the (potentially incorrect) impression (from a very naive/inexperienced POV) that MiniVM+JIT would be looking to close a more widely-scoped, higher-level loop than something like libFirm would be. So it'd be closer to Cling (https://root.cern/cling/) than raw LLVM, perhaps (albeit with 0.01% of the code size :D). It is for this reason that I kind of pause for a minute and ponder that a fully integrated JIT could be a pretty good idea. It would absolutely make the irreducible complexity of the project balloon, with reasonable motivation likely necessary to maintain cohesion.

    If I were to backseat-drive for a minute :) the first thing I'd rant about is how attractive modern JITs need trivial ways to verify code correctness, both online (how exactly was *this* specific generated code constructed - so, straightforward logging) but also (and particularly) offline (humans staring at the JIT source code and mentally stepping through its behavior - and succeeding (miracles!!) because the code is small and well-written). If the JIT implemented in such a straightforward manner, end users wanting to run potentially malicious user-supplied code with high performance in potentially security-sensitive settings might be attracted to the project. (Mike Pall made bank for a while while CloudFlare was using LuaJIT for its WAF... ahem...)

    I came across this reference of how to break out of LuaJIT 2.1 (2015) a while back: https://www.corsix.org/content/malicious-luajit-bytecode - and every time I take a look at the code I switch away from the tab :) (and sometimes step away from the computer for a minute :D). It's solely a demonstration of "this is how it would work", and clarifies that LuaJIT makes no sandbox guarantees about the code it executes, but reading through it, the amount of Stuff™ going on represents a surface area that to me (naively) seems just... like LuaJIT as a whole is generally too large to easily reason about from a security standpoint (oh yeah, besides being written in assembly language...). This might be inexperience speaking, but I can't help but wonder whether a smaller, simpler implementation might be able to implement a secure JIT; for all I know this might be an impossible P=NP pipe dream I haven't fully grasped yet, I guess what I'm trying to figure out is whether "small enough to mentally reason through" and "large enough to do a few things quickly" have practical overlap?


    On an unrelated note, something I discovered recently and which I thought I'd idly mention is that JITs might seem to have a bit of a hard time on Android. I can't (yet) tell if this is LuaJIT-specific or "anything that's a JIT"-specific: KOReader (Android eBook reader, implemented entirely using LuaJIT) has a bunch of very scary magic Things™ it seems to need to do to make LuaJIT even work at all on Android (https://github.com/koreader/android-luajit-launcher/blob/mas...), due to a apparently-current issue causing issues across different domains (https://github.com/LuaJIT/LuaJIT/issues/285), which has been apparently cropping up going back years (https://www.freelists.org/post/luajit/Android-performance-dr... (2013)). KOReader has even nontrivially patched LuaJIT's C code in places (https://github.com/koreader/android-luajit-launcher/blob/bb0...) with purposes I am yet to fully understand (it might just be for debugging). I happened to be considering idly playing around with Lua on Android (currently fascinated with interpreted/JITed runtimes) and after stumbling on this I'm debating whether to use Lua instead, ha. I've been meaning to ask around on the LuaJIT list and wherever KOReader discusses stuff to learn more, after focusing on actually getting LuaJIT linked into an Android project and poking around. Haven't got to it yet. This could be an absolutely massive red herring that I'm going deer-in-headlights about because it just looks off-in-the-weeds, or potentially significant. It might also be absolutely irrelevant, but as I noted I'm not (yet) sure how to tell.

  • Hammerspoon – Lua-based powerful tool automation of macOS
    15 projects | news.ycombinator.com | 12 Dec 2021
    Hammerspoon is fantastic. And Lua is a such a fun little language to program in. And with LuaJIT [0] you can run it on your nginx webserver [1] at basically the speed of C code. It's really a marvel of engineering.

    [0] https://luajit.org/

    [1] https://openresty.org/en/

  • Ask HN: How did Python become the lingua franca of ML/AI?
    4 projects | news.ycombinator.com | 9 Nov 2021
    LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/

What are some alternatives?

When comparing mir and LuaJIT you can also consider the following projects:

lua-languages - Languages that compile to Lua

Wren - The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.

moonjit - Just-In-Time Compiler for the Lua Programming language. Fork of LuaJIT to continue development. This project does not have an active maintainer, see https://twitter.com/siddhesh_p/status/1308594269502885889?s=20 for more detail.

ravi - Ravi is a dialect of Lua, featuring limited optional static typing, JIT and AOT compilers

nelua-lang - Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.

lua-luajit-compound-operators - Compound Operators patch for lua/luajit

terra - Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.

luajit2 - OpenResty's Branch of LuaJIT 2

moonscript - :crescent_moon: A language that compiles to Lua

pallene - Pallene Compiler

PackageCompiler.jl - Compile your Julia Package

nelua-decl - C binding generator for Nelua using GCC Lua plugin.