LunarWaveVM is a Lua 5.4 virtual machine written in Rust.
 
 
Go to file
_ 4e9f9a74c5 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00
pictures 📝 doc: roadmap 2023-09-27 13:58:37 -05:00
src 🐛 bug: fix io.write and take off the `max_iters` restriction 2023-10-01 01:36:40 -05:00
test_vectors 🐛 bug: fix OP_TEST ignoring `k` 2023-10-01 01:33:47 -05:00
.gitignore 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00
COPYING.txt 📝 doc: license 2023-09-27 14:03:21 -05:00
Cargo.lock ♻️ refactor: invoke luac during tests so I don't have to version artifacts 2023-09-26 12:04:17 -05:00
Cargo.toml 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00
README.md 📝 doc: benchmark results 2023-10-01 02:00:23 -05:00

README.md

LunarWaveVM is a Lua 5.4 virtual machine written in Rust.

A star field with an orange crab-shaped nebula facing a dark purple moon with a bright magenta crescent.

luac5.4 -o - test_vectors/fizz_buzz.lua | cargo run -- --pipe-bytecode

1
2
3       Fizz
4
5       Buzz
6       Fizz
7

...
44
45      FizzBuzz
46
47
48      Fizz
49
50      Buzz

Roadmap

  • Loading simple pre-compiled bytecode programs
  • Hash tables
  • Fizzbuzz
  • Closures
  • Error handling
  • Garbage collection
  • Long strings
  • Using arrays internally for tables
  • Compiling Lua source code to bytecode

Benchmark

9x slower than PUC Lua, 90x slower than LuaJIT.

Based only on the n-body simulation from the computer language benchmarks, because it's easy to run.

time target/release/lunar_wave_vm --script test_vectors/n_body.lua -- 500000; time lua test_vectors/n_body.lua 500000; time luajit test_vectors/n_body.lua 500000;
-0.169075164
-0.169096567
[src/main.rs:110] x = []

real	0m10.543s
user	0m10.535s
sys	0m0.000s
-0.169075164
-0.169096567

real	0m1.173s
user	0m1.165s
sys	0m0.004s
-0.169075164
-0.169096567

real	0m0.117s
user	0m0.116s
sys	0m0.000s