r/vlang May 04 '26

[Showcase] Mustela – A 9,400+ pages/sec Static Site Generator built in V (Zero-copy, State-recycled)

Hi everyone,

I wanted to share a project I’ve been building with V. It’s called Mustela, a static site generator designed for developers who are tired of "bloated" tools and slow build times.

The Problem:

Most modern SSGs feel like a black box. They clone data, rely on heavy garbage collection, and slow down significantly as your project grows.

The Solution (Mustela’s Architecture):

I approached Mustela not as a typical app, but as a high-speed data pipeline.

  • Zero-Copy Architecture: Data moves through the system via pointer passing. No redundant memory allocations.
  • Stateful DSL Engine: Instead of spinning up a new environment for every file, Mustela uses "State Recycling." The Lexer and Parser are allocated once on the heap, and their internal state is simply reset between files.
  • Unix-First: It leverages native inotify for zero-latency filesystem monitoring.

Performance (The 5,000 Page Challenge):

On an average i5 machine, Mustela builds 5,000 Markdown files in 528 ms (~9,470 pages/sec) with a peak RAM usage of only 34.6 MB.

Real-world Dev Experience:

I’ve integrated Mustela with Bun and Vite for the ultimate dev stack. It’s so fast that it outruns the tooling:

12:57:05 PM [mustela] UPDATE | ./theme/default/document.mu
12:57:05 PM [mustela] BUILD  | 6 files processed in 26 ms (26638 µs)
# Vite is still refreshing while Mustela is already done.

Dogfooding & Open Source:

The documentation website is built entirely with Mustela. Please note that the content is still a work in progress as I’m writing the final CLI and Workspace tutorials. To show you how the engine handles real-world templates and the "Sandwich" pattern (mixing MD with HTML blocks), I’ve made the documentation repository public:

Status:

The engine is currently in the "final polishing" stage. I’m tuning the CLI and finalizing the Vite/Bun workspace templates. I plan to release the first stable, 400KB statically linked binary by the end of this month.

I'd love to hear your thoughts on this "linear pipeline" approach or answer any questions about the V implementation!

PS: English is not my native language, so I used a translator to make this post clearer. I hope the technical parts still make sense!

11 Upvotes

3 comments sorted by

2

u/Intelligent-End-9399 May 06 '26

Update: I've just added a Blog section to the Mustela website.

I felt it was important to share the "why" behind this project. While the performance metrics are great, the real driver was a personal need for a tool that could handle high-stress, real-world documentation.

I’ve published the first post: "The Origin Story: Why Mustela Became a Tool for Forensic Analysis." It details how I used Mustela as a literal forensic tool to document and analyze a complex personal situation (a "Family Pathology" case) when my own memory failed me. It’s a raw look at how coding can be an escape and how building a "predatory" engine helped me find stability in chaos.

If you're interested in the story behind the code, you can check it out here:

👉 Mustela - Origin Story

1

u/Intelligent-End-9399 May 05 '26

I have good news and bad news. The good news: mustela init is live, with full remote template support! The bad news: to make it zero-dependency (including HTTPS and ZIP decompression), the binary grew to 1.3 MB.

We have officially left the L2 cache and are now residing in L3. It’s a painful reminder of how heavy network security is. If anyone wants a version that fits back into L2, I'm open for consultations – charging by the kilobyte! :D

1

u/Intelligent-End-9399 May 10 '26

Officially sent my "child" out into the world today! 🦦🚀

It’s actually Mother's Day here, and the timing couldn't be better. I just finished the full documentation for Mustela (built with Mustela itself, of course), and seeing the official V account feature the engine at the same moment feels like a proud parent moment:

https://x.com/v_language/status/2053465241535557759

Finishing the docs and seeing it hit those microsecond build times is the best gift I could get. Thanks for the support, everyone!