Rusty Vue: Vue Compiler rewritten in Rust

346 points HerringtonDarkholme

Hey folks, I am porting Vue's core compiler to Rust. My goal is mainly learn how to build a high performance software and help Rust to become a more popular frontend tooling. The project repo is here https://github.com/HerringtonDarkholme/vue-compiler.

The project at the moment has completed feature parity with @vue/compiler-core . Compiling to dom, ssr, sfc have not yet been implemented. You can check what has been implemented in the playground

Preliminary benchmark shows the native version takes about 1/5 \~ 1/7 time compared to the one run inside a VM.

JS version benchmark, in millisecond

Rust version benchmark, in nano second

Continuous benchmark chart can be found here https://herringtondarkholme.github.io/vue-compiler/dev/bench/.

​

If you are interested, I can also post another article how I optimize the Rust code. Beating highly optimized V8 engine is not that easy and arguably Vue compiler is already fast enough for most projects. (But let me know if you have a huge Vue project that compiling template is a bottle neck!)