Earlier quoted context omitted.
In this specific case the fast compilation is down to having 0 dependencies. Rust is usually only rivalled by npm in terms of number of dependencies that a typical project pulls. This project is a refreshing take!
people using deps for trivial things and those trivial things pulling 100s more deps for more trivial things is not really a rust or npm issue. its an issue of people becoming really lazy in light of amazing package management tools. its weird how good pkg mgmt has this totally shit side effect for compilation, but it sure makes buildong things faster. (which in rusts case i guess can go a long way as coding stuff ca…
Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
11–18 of 18 posts
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#12Earlier quoted context omitted.
In this specific case the fast compilation is down to having 0 dependencies. Rust is usually only rivalled by npm in terms of number of dependencies that a typical project pulls. This project is a refreshing take!
people using deps for trivial things and those trivial things pulling 100s more deps for more trivial things is not really a rust or npm issue. its an issue of people becoming really lazy in light of amazing package management tools. its weird how good pkg mgmt has this totally shit side effect for compilation, but it sure makes buildong things faster. (which in rusts case i guess can go a long way as coding stuff ca…
that's because the package management tools aren't amazing, those would distribute prebuilt stuff pluggable into your project with close to 0 build time overhead vs. today where everyone has to constantly build all the deps
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#13Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#14What means "more variants per instruction" here?
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#15How well does it perform when evaluating itself? Can it bootstrap?
I haven’t tried this, but Stitch should technically be able to run itself if we gave it a C-like API that you could export from a Wasm module. Would be fun to try at some point :-)
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#16Earlier quoted context omitted.
I haven’t tried this, but Stitch should technically be able to run itself if we gave it a C-like API that you could export from a Wasm module. Would be fun to try at some point :-)
Wouldn't you need to add support for the tail call extensions, return_call (opcode 0x12) and return_call_indirect (opcode 0x13)? Stitch doesn't appear to implement those, even though Stitch itself relies on TCO for instruction dispatch, for which (IIUC) LLVM would emit return_call or return_call_indirect.
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#17> The reason Stitch is slightly faster than Wasm3 on Mac, but slightly slower on Linux, is likely because Stitch has more variants per instruction compared to Wasm3, which puts pressure on the instruction cache. I suspect this gives Stitch the edge on the Apple M2 Pro, with its large instruction cache, but Wasm3 the edge on the Intel Xeon E312xx, with its smaller instruciton cache. What means "more variants per instr…
Each operand is either stored on the stack (s), a virtual register (r), or as an immediate value (i). The add instruction, for instance, has an add_ss variant, an add_rs, and an add_ri variant, among others.
Most instructions store their result in a register, so that subsequent instructions operating on the result can avoid a stack load.
i32/i64/f32/f64.const instructions are completely elided: instead of storing constant values on the stack, they are stored as an immediate operand for the next instruction (this is one area where stitch differs from wasm3, which preloads all constants for a function on the stack every time the function is called)
I hope that clarifies things :-)
Re: Makepad-stitch: WASM interpreter in Rust, 15kloc, 0 deps, faster than wasm3
#18Earlier quoted context omitted.
Wouldn't you need to add support for the tail call extensions, return_call (opcode 0x12) and return_call_indirect (opcode 0x13)? Stitch doesn't appear to implement those, even though Stitch itself relies on TCO for instruction dispatch, for which (IIUC) LLVM would emit return_call or return_call_indirect.
That’s a good point! I did’t even think about that. For Stitch to become self hosting, we’d either have to implement those instructions, or implement a fallback mode using an interpreter loop with a trampoline. The latter would negate most of the speed benefits of Stitch though.