Loading video...

Video Failed to Load

Go Home

My WebAssembly debugger lets you time-travel with your scroll wheel. WebAssembly (and Ghostty) are so fast that a step back just reruns from scratch.

113,665 views • 7 days ago •via X (Twitter)

44 Comments

Patrick Smith's profile picture
Patrick Smith7 days ago

GitHub:

Adam Dymitruk's profile picture
Adam Dymitruk6 days ago

Everything needs event sourcing by default.

Santiago Pablo Ortiz's profile picture
Santiago Pablo Ortiz5 days ago

This is awesome man

👼🏿's profile picture
👼🏿7 days ago

so blinkenlights @jartine made but without its aesthetics?

Aarav Dayal's profile picture
Aarav Dayal5 days ago

What is the optimization? Keeping the diff of the memory for each instruction stepping? Because how will you unexecute an instruction usually?

Patrick Smith's profile picture
Patrick Smith5 days ago

The optimization is to make it fast enough that I just replay everything to “unexecute”.

Aarav Dayal's profile picture
Aarav Dayal5 days ago

No I mean how do you capture all of it such that it does not take gigabytes of memory to record a program's execution?

Patrick Smith's profile picture
Patrick Smith5 days ago

What do you need gigabytes for? There’s an interpreter. A step forward executes the next instruction. A step back executes all the instructions from the beginning up to the previous step. The speed is what allows that to feel instant. There’s no capturing and no caching.

Aarav Dayal's profile picture
Aarav Dayal5 days ago

"A step back executes all the instructions from the beginning up to the previous step." Oh so this is the tradeoff. Thank you lmao. This is what I wanted to know.

RandomYang's profile picture
RandomYang6 days ago

It’s fascinating that program execution accumulates state, so stepping back means replaying from the start up to step n-1.

TG's profile picture
TG6 days ago

I have wanted this, so very many times. Also video like controls would be good with speed options to debug in real time. Play, Stop, SlowMo, Step.

Patrick Smith's profile picture
Patrick Smith5 days ago

I’ve created a free Discord community for everything QIP, the wasm component system behind this:

ibuki's profile picture
ibuki5 days ago

Wasmは純粋な計算だけだから再実行って手段が実現できるのか

LinuxVersion's profile picture
LinuxVersion7 days ago

I assume you will make snapshots periodically to simulate forward from instead of time traveling from the start for long running programs (and diff the snapshots to only store changes)

Patrick Smith's profile picture
Patrick Smith7 days ago

No snapshots in this demo. I expect for larger wasm components I’ll have to add some snapshotting but I’ll measure exactly where that line is.

ricochet's profile picture
ricochet7 days ago

love this!

Preyforge's profile picture
Preyforge5 days ago

time-travel debugging is such a good use of the interface. i keep runs interruptible so the human can take the mouse when the path gets weird; observability should make that handoff easier, not ceremonial.

Shang Yuzu's profile picture
Shang Yuzu6 days ago

j’ai pas lu la notice.

Multiple Systems's profile picture
Multiple Systems6 days ago

why is it important how fast ghostty is?

Francois Laberge's profile picture
Francois Laberge6 days ago

I was surprised how well for shortish recordings of another app just replaying up to playhead sufficed. Wasn't even in webassembly. This looks great.

Mykhailo Kulak 🇺🇦's profile picture
Mykhailo Kulak 🇺🇦6 days ago

This is cool!

mfpaintr's profile picture
mfpaintr6 days ago

Cool, but why a terminal? Debugging is about visualizing what is happening. A GUI can provide a much better experience.

deus's profile picture
deus6 days ago

cool

Nilo Stolte, PhD 🍁⚙️'s profile picture
Nilo Stolte, PhD 🍁⚙️6 days ago

This is petty cool! My question isn't directly related to WebAssembly, but to Ghostty. How is your overall experience with Ghostty going so far? How long you've been using it?

Patrick Smith's profile picture
Patrick Smith6 days ago

Ghostty is really nice! I previously just used the built-in macOS Terminal so I want something simple. It’s the split panes and modern rendering that I really appreciate.

Nilo Stolte, PhD 🍁⚙️'s profile picture
Nilo Stolte, PhD 🍁⚙️6 days ago

I've seen your demo for qip, a chronometer that uses canvas and fonts to render the numbers. I'm curious about the language that you used for this piece. I suppose you didn't write WebAssembly directly.

Patrick Smith's profile picture
Patrick Smith6 days ago

Yes that example is in Zig. I’m using the Codex coding agent, first I’ve made an Inter font lib, then iteratively made this example. I’m sure the code could have many improvements, but it’s pretty vanilla imperative code.

Nilo Stolte, PhD 🍁⚙️'s profile picture
Nilo Stolte, PhD 🍁⚙️5 days ago

I checked how you rendered the "glyphs" and I saw it's bitmap. I thought your were dealing with real vector glyphs. Also the program is quite long. Check my vector clock in Java. It's simpler:

Hi O'laverly's profile picture
Hi O'laverly5 days ago

Oh, nice. I'm going to have to take a look at that.

Jarno's profile picture
Jarno6 days ago

Debugging by rewinding time instead of adding print statements. Perfect.

allOS.dev - Creating Cross-Platform Apps's profile picture
allOS.dev - Creating Cross-Platform Apps6 days ago

So cool! Following!

hardikxk's profile picture
hardikxk7 days ago

Btw does also it work for WAT files or just anything that compiles to wasm?

Patrick Smith's profile picture
Patrick Smith6 days ago

Is wat files something you’d be authoring? I’d suggest using wat2wasm

hardikxk's profile picture
hardikxk6 days ago

Had been exploring wat as of late with wat2wasm but yes it is a pain to write wat files over simply using JS or c++ even

ø's profile picture
ø6 days ago

This is the way...

William Selby's profile picture
William Selby6 days ago

Okay this is so sick? Is it on Github?

Patrick Smith's profile picture
Patrick Smith6 days ago

Thanks! Yes it is:

sshpie's profile picture
sshpie5 days ago

That's cool

Dylanger Daly's profile picture
Dylanger Daly6 days ago

Yummy

Yeab - engg / core was in Palo Alto🌴's profile picture
Yeab - engg / core was in Palo Alto🌴6 days ago

cool

Nawid's profile picture
Nawid6 days ago

Fantastic

keshen's profile picture
keshen5 days ago

what if your program did a side effect

kiby3x's profile picture
kiby3x6 days ago

how does that work calling JS functions that aren't pure?

Valentyn Kit 🦀 | Rust · Solana's profile picture
Valentyn Kit 🦀 | Rust · Solana7 days ago

"reruns from scratch" being fast enough to feel like a rewind is the whole trick.

Related Videos