Marmot Go Compiler Builds on MLIR and LLVM

Compiler error output from the marmot Go compiler with a suggested fix

The marmot Go compiler is a new experimental project that keeps Go’s front end but hands code generation to MLIR and LLVM. Its author reports binaries several times smaller than the standard toolchain produces and a geometric mean run time 1.54x faster across 45 test programs. It is not ready for production.

How the marmot Go compiler is built

Go’s type checker, its SSA builder and its standard library all stay in place, since they define the language. Marmot swaps out only the code-generating stages. Between them sits a small MLIR dialect called “go”, which holds on to Go semantics long enough for the compiler to drop bounds checks, avoid heap allocation for some objects and make direct calls to interface methods.

From there the code lowers to LLVM IR and then to machine code. In one example on arm64, a loop that sums a slice of int32 values loses its bounds check and compiles to vector instructions that add four values at a time.

You keep your Go source and your go.mod file. Only the compiler changes.

The project’s pitch is simple: switch compilers and get small, fast native binaries along with error messages that show the fix. The layers are visible in its own example. Go source goes in, MLIR with the go dialect describes the slice index and its bounds check, LLVM IR shows the check removed and the loop vectorized, and arm64 machine code uses two 128-bit loads and four vector adds.

marmot build: error M0014, Square does not implement Shape, with labels on the interface and on the method with a pointer receiver, and a fix that adds &
Image: marmot.gaurav.zip

What the benchmarks show

The numbers come from an Apple M3 Pro, with every program’s output checked against Go’s. The project lists these results:

  • A hello world using println builds to 201 KB with marmot and 1.83 MB with go.
  • A hello world using fmt.Println builds to 698 KB with marmot and 2.43 MB with go.
  • Across 45 programs in release mode, marmot is 1.54x faster by geometric mean. It wins on 37 and loses on 8.

Build times were measured on cmd/marmot, which has 325 packages, on 14 November 2026. A first build with empty caches takes 4.40 to 4.57 seconds, against 6.14 to 6.18 seconds for go. Rebuilding with nothing changed takes 0.05 seconds against 0.15. A one-line edit in a leaf package takes 0.59 seconds against about 0.66 to 0.68, and in a deep package 0.72 to 0.76 seconds against 1.18 to 1.23.

Errors that suggest a fix

Each error prints the offending source, underlines the exact span, labels every location involved and offers a fix. The marmot fix command can apply that fix. Each of the 44 error codes is stable and documented.

When a terminal is not attached, as with a coding agent, errors come out as JSON with the spans, the surrounding source and the fixes expressed as edits. On a terminal, the output matches the plain lines the go tool prints.

One command for the whole loop

The command line mirrors the go command, and it folds in tools that people normally install alongside it. The list covers build, run, test, check, fix, fmt, watch, repl, bench, prof, size, generate, explain, doctor and mcp.

  • check runs vet, lint, gopls, vuln, tidy and cross builds in one cached pass.
  • watch builds, runs or tests again after every save.
  • size shows what a binary contains and why a given function is in it.
  • mcp exposes the build, run, test, fix and explain commands to coding agents.

Release builds use whole-program optimization, while dev builds favor fast rebuilds.

What to know before trying it

The project describes itself as experimental. The compiler can build real Go programs, itself among them, and every test program’s output is compared with Go’s. Even so, the project says it isn’t ready for production. Eight of the 45 benchmark programs ran slower than with the standard compiler, so results will vary by workload.

For Go developers, the draw of the marmot Go compiler is smaller binaries and faster rebuilds without rewriting code. Anyone considering it should run their own programs through both compilers and compare output and timing before relying on it.

Source: marmot.gaurav.zip

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.