hn.today

Marmot, an Alternative Go Compiler

marmot.gaurav.zip15 points0 comments
Screenshot of Marmot, an Alternative Go Compiler

Marmot is an experimental alternative Go compiler designed to preserve ordinary Go source and go.mod files while producing native binaries through MLIR and LLVM. It reuses Go’s type checker, SSA builder, and standard library, replacing the code-generation portion of the toolchain. A Go-aware MLIR dialect retains language details long enough for compiler passes to optimize them - for example, removing slice bounds checks and enabling vectorized operations. The project also aims to make errors actionable: diagnostics identify exact source spans, explain the relevant types or methods, offer suggested edits, and expose stable error codes. Those fixes can be applied by Marmot itself or returned as structured JSON for coding agents.

Benchmarks on an Apple M3 Pro report substantially smaller release binaries: 201 KB versus Go’s 1.83 MB for a println example, and 698 KB versus 2.43 MB with fmt.Println. Across 45 runtime tests, Marmot is 1.54 times faster geometrically, with 37 programs faster and eight slower; measured initial builds and rebuilds are also quicker in the cited cases. Its command-line suite covers building, running, testing, formatting, fixing, checking, watching, benchmarking, profiling, and more. The site says Marmot compiles real programs, including itself, and checks test-program outputs against Go, but emphasizes that it is not production-ready.

Read on marmot.gaurav.zip0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Source Control from Hell

Source Control from Hell

An early software job relied on a shared folder, manual change descriptions, and a tech lead copying code by hand, with coworkers announcing when they needed access to avoid overwriting each other. Discovering Git showed Alex how version control could make collaboration faster and safer, but his company kept its old process for years because it worked well enough for them. (frantic.im)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.