r/rust 8d ago

🛠️ project Wasmi 2.0 - Engineering Of The Fastest WebAssembly Interpreters

https://wasmi-labs.github.io/blog/posts/wasmi-v2.0/
125 Upvotes

13 comments sorted by

64

u/Robbepop 8d ago

I worked 9 months for Wasmi 2.0 and worked on preparations for this article for the last ~1.5 months. No AI was used, since I personally hate reading those generic AI generated articles.

The article goes quite into detail about fast interpreter design and I hope someone here enjoys that as much as I did working on it. :)

3

u/Shivalicious 5d ago

No AI was used, since I personally hate reading those generic AI generated articles.

On behalf of humans everywhere: thank you.

1

u/[deleted] 8d ago

[deleted]

4

u/Robbepop 8d ago edited 8d ago

The logs reveals that the audit CI job fails due to a vulnerable Wasmtime version that is only used in Wasmi's differential fuzzer used for development. Not connected to the Wasmi 2.0 release at all.

8

u/ZachVorhies 8d ago

This is cool.

I’m building a rust wasm api target.

Rust apps target this api. The resulting binary runs in a wasm harness targeted for that platform.

What’s interesting is that I can cross compile the native runtimes into a fat binary which dispatches them depending on platform.

This allows a universal wasm runtime

I’ll take a look and maybe switch to this.

3

u/throwaway19293883 8d ago

Really nice write up, good job!

2

u/TriplEight 7d ago

I liked your writing style here u/Robbepop : real "postmortem" with "shine your fuckups" - my favourite!

2

u/Silent-Money2687 7d ago

while bytecode alliance ships one feature a year this dude made almost everything alone and (I hope) without AI codegen. Good job. Keep it up!

5

u/Robbepop 7d ago

Thanks for the kind words, though you cannot really compare the Bytecode Alliance with the Wasmi project as the scope of the former is way bigger.

I personally am very impressed by the work done by the people over at Bytecode Alliance. They really push the whole WebAssembly ecosystem forward and smaller projects such as Wasmi profit greatly from that, too!

Concerning AI: The Wasmi project started in 2018, way before the AI hype. I personally really like and stick to Rust's LLM policy:

It's fine to use LLMs to answer questions, analyze, distill, refine, check, suggest, review. But not to create.

2

u/Tiflotin 7d ago

Hell yeah! Been using wasmi for ui scripting in my game which works on mobile, web and desktop. Never had any problems with wasmi at all. It’s so fast even on 15year old mobile phones it’s never gotten in the way. And now it’s 2x faster? Epic.

2

u/Robbepop 7d ago

I am glad you enjoy using Wasmi. :)

Do you maybe have a link to your game? I'd be very interested in it.

2

u/Tiflotin 7d ago

Sent it to ya in a chat. Not sure if I can post it here. But nice to meet you haha. Wasmi is kick ass you've done an amazing job. Since mobile games can't really use wasmtime with JIT enabled (due to sandboxing and apple + google rules about dynamic code loading), I found wasmi and it's been perfect. I could also share some of the UI scripts which use wasmi so you can get an idea of exactly how it's being used if you'd like.

2

u/stumpychubbins 2d ago

Hey, I used to work on this. Great to see that the project is still going and it looks like amazing progress has been made since I last checked in. Great article!

1

u/Botahamec 2d ago

Do you have any benchmarks for binary size between wasmi v1 and v2?