HeadlinesBriefing favicon HeadlinesBriefing.com

Goose: Memory-Safe Language Beats C++ and Rust

Hacker News •
×

Goose is a memory-safe systems language that outperforms C++ and Rust in speed and memory usage. It runs 1.16x faster than hand-optimized C++ and 1.12x faster than safe Rust, while using 1.3x and 1.2x less memory respectively. The language achieves this through a unique memory model with no heap, garbage collector, or lifetime annotations.

All dynamic values live on compiler-managed data stacks, where memory is freed solely by scope exit. This design eliminates allocators, reference counting, and moving memory. Goose supports flat data structures, typed references without lifetime syntax, and position-independent data via narrow offsets.

Enums use variable-mode ADTs for 4x less memory and 2x speed vs Rust. Errors propagate via static return without unwinding or Result types. Threads share no memory, communicating via memcpy over typed queues.

Generics and higher-order functions compile to zero-overhead loops. Goose emits plain C code, runs anywhere a C compiler works, and includes a Tiny CC backend for in-process execution. The language requires no build step for basic use and is fully demonstrated in its tutorial, specification, samples, and benchmarks.