← Back to Tech Radar
Hacker News tech

Marmot, an Alternative Go Compiler

Trending on Hacker News: Marmot, an Alternative Go Compiler (68 points / 18 comments, via marmot.gaurav.zip)

In one line

Keep your Go code, switch the compiler, and get small native executables. Fast builds and errors that teach.

Opening excerpt

marmot is a Go compiler built on MLIR and LLVM. Keep your Go code and your go.mod, switch the compiler, and get small, fast native binaries and errors that show you the fix.

Experimental: marmot compiles real Go programs, including itself, and checks every test program against Go, but it is not ready for production.

var s int32 for _, x := range xs { s += x } return s MLIR, with the go dialect Still Go: an index into a slice, with its bounds check.

%v9 = llvm.extractvalue %a0[0] : !llvm.struct<(ptr, i64, i64)> %v10 = llvm.extractvalue %a0[1] : !llvm.struct<(ptr, i64, i64)> %v11 = go.index %v9[%v7] len %v10, i32 : i64 %v12 = llvm.load %v11 {alignment = 4 : i64, go.unsafe} : !llvm.ptr -> i32 %v13 = llvm.add %v1, %v12 : i32 LLVM IR The check is gone; four int32 values at a time.

(Excerpted from the original; full article via the source link below.)

This story hit the Hacker News front page today (68 points / 18 comments, via marmot.gaurav.zip). Our Tech Radar aggregates daily signals on AI engineering, backend architecture and DevOps — browse the related services and further reading below, or get in touch with our team.

Source: Hacker News

Related Services

Related Reading