Zune: A luau runtime built & written with Zig

This is my first Zig project, and I wanted to create a luau runtime written in Zig, whilst also achieving the most amount of performance as a way to learn about Zig.

In short, zune is a luau runtime similar to how Bun is a JavaScript runtime.

Features:

  • Supports Linux, Windows, macOS, and FreeBSD.
  • A Test Runner backend for testing Luau code.
  • Bundling/Compiling into an executable.
  • Built-in Standard Libraries.
  • Built-in Debugger.
  • Types & docs for LSP.
  • Small Release Binary Size.

The networking backend, like HTTP client and server with TLS support, using ianic/tls.zig, is built entirely in zig and made particularly for zune, with the custom HTTP Server implementation reaching ~152k req/s on my machine (Ryzen 7 5800X, Linux, io_uring), single threaded, powered with a custom libxev fork.

In the process of making this project, I also worked on another library originally forked from ziglua, zig-luau (repository under the same zune organization), which is made for luau in Zig, porting some C++ code into Zig code, like most of the gc, mem, and lua C api, mainly to avoid C exceptions. This was also part of the performance goal: to compile code mostly with Zig.

11 Likes

Microsoft might still own a trademark (or other legal protection) on the name “Zune”.

2 Likes

The name and trademark were abandoned in 2010. I have checked this before landing on the name, unless I am mistaken, correct me if I am wrong.

5 Likes

Looks like the trademark is “DEAD APPLICATION Refused Dismissed or Invalidated” according to https://uspto.report/TM/88153817. Nice find for the name!

3 Likes

This is an amazing project! A whole runtime for the Luau language in Zig. I haven’t dived deep into it. Does it support garbage collection?

It should already come with garbage collection support, as it is part of luau, scripting language derived from Lua.

Trademarks are only enforceable if there’s a risk of consumer confusion. A Zig project (cool project!) is not an MP3 player, or enough like one to run the risk.

Nintendo isn’t going to sue me for zelda either, and that brand is quite actively maintained.

3 Likes