• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Rust
  • Created about 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Comparing unsafe Rust vs Zig by writing a bytecode interpreter with GC in both langs

Rust vs. Zig

This is an experiment to evaluate Rust vs. Zig by writing a bytecode interpreter with GC in both languages and comparing them.

The interpreter implementation is from the Crafting Interpreters book.

I wrote a comprehensive summary of this experiment on my personal blog.

Rust implementation

This is in the loxide folder.

To build it:

# in the root project directory
make rust

# inside the rust folder
cargo build --release

To run the tests:

cargo test

# Run with miri to check for undefined behaviour
cargo miri test

Zig implementation

This is in the zlox folder.

To build it:

# in the root project directory
make zig

# inside the zlox folder
# run `zig build help` for options
zig build

To run the tests:

zig build test
zig-out/bin/zlox

Benchmarks

The benchmarks folder contains the code ("*.lox" files) the two interpreters run and the results of the benchmarks. The results are run using hyperfine.

More Repositories

1

aussieplusplus

Programming language from down under
Rust
612
star
2

tyvm

An experimental bytecode interpreter / type-checker for type-level Typescript
Zig
430
star
3

go-playground-wasm

A version of play.golang.org that runs completely in the browser
TypeScript
183
star
4

glyph

My own personal code editor built with Rust + OpenGL
Rust
157
star
5

node-soundcloud-downloader

A SoundCloud API v2 wrapper for Node.js
TypeScript
134
star
6

tyfsm

(wip) simple and typesafe finite automata based state management library. Inspired by zustand and xstate
TypeScript
123
star
7

tether

WIP high-performance code editor inspired by Doom Emacs and neovim. Comes with explosions.
Zig
65
star
8

lofi-cli

Listen to ChilledCow's lofi hip-hop stream from the command line
JavaScript
27
star
9

soundcloud-api

A SoundCloud API v2 wrapper for Go
Go
26
star
10

write-your-own-zod

Write your own Zod from scratch
TypeScript
14
star
11

force-directed-graph

experiment
Rust
11
star
12

bun-macros-flappy-bird

C
5
star
13

prisma2gql

prisma schema 2 graphql schema generator
Haskell
4
star
14

iszacksleeping

A way to actually contact me and hold me accountable to a sleep schedule
TypeScript
3
star
15

toilet-paper-twitter

a stupid graphics experiment
HTML
3
star
16

cheatsheets

TypeScript
2
star
17

rasta

Building a software rasterizer for fun
Rust
2
star
18

downloadsound.cloud-api-go

Go
1
star
19

c-template

Simple C project starter template
C
1
star
20

rust-emscripten-bug

Rust
1
star
21

youtube-rooms-frontend

TypeScript
1
star
22

learning-crdts-rust

Learning and implementing CRDTs in Rust
Rust
1
star
23

downloadsound.cloud-api

TypeScript
1
star
24

youtube-rooms

Go
1
star
25

downloadsound.cloud

TypeScript
1
star
26

sticky

Fixing my broken right arrow key
Objective-C
1
star