
The fastest LoongArch sandbox
libloong is a 64-bit high-performance LoongArch emulator library designed for embedding and high-frequency scripting. Built on the architecture of libriscv, it provides the fastest 64-bit interpreter performance available, maintaining a compact ~18k LOC codebase with zero dependencies.
You can also run LoongArch64 Linux programs in the command-line interface.
In CoreMark 1.0 interpreter benchmarks (December 2025), libloong leads the 64-bit category on the Ryzen 7950X, reliably reaching a score of 3000+.
| Interpreter | Architecture | Score |
|---|---|---|
| libloong | 64-bit LoongArch | 3045 |
| libriscv | 64-bit RISC-V | 2865 |
| stitch | Wasm | 2743 |
| wasm3 | Wasm | 2368 |
| wasmer (WAMR) | Wasm | 2314 |
| wasmi | Wasm | 1967 |
Advanced Modes: While the interpreter is the primary focus for portability, libloong includes a lightweight JIT reaching 38% of native (15.5k CoreMark) and an embedded binary translator reaching ~77% of native (31.9k CoreMark).
Game engine scripting is where libloong excels. Traditional games expose modding through shared libraries (full system access), embedded VMs like Lua (~150ns call overhead), or Java run-times. libloong has ~4ns call overhead.

See the example Asteroid game.
CMake configuration options:
LA_DEBUG=ON/OFF - Enable debug output (default: OFF)LA_BINARY_TRANSLATION=ON/OFF - Enable binary translation (default: OFF)LA_THREADED=ON/OFF - Enable threaded bytecode dispatch (default: ON)LA_MASKED_MEMORY_BITS=N - Set masked memory arena size to 2^N bytes (0 = disabled, default: 0)Example with options:
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DLA_MASKED_MEMORY_BITS=32 \
-DLA_BINARY_TRANSLATION=ON
make -j6
#include <libloong/machine.hpp>
int main() {
// Load a LoongArch ELF binary
std::vector<uint8_t> binary = load_file("program.elf");
// Create a machine with 64MB memory
loongarch::Machine machine { binary, {
.memory_max = 64 * 1024 * 1024
}};
// Setup program arguments
machine.setup_linux({"program"}, {"LC_ALL=C"});
// Run the program
machine.simulate();
}