From GitHub · · 4m
Goose: A faster, safer systems language
New programming language eliminates heap allocation and garbage collection while outperforming C++ and Rust.
In brief
New programming language eliminates heap allocation and garbage collection while outperforming C++ and Rust. Goose achieves memory safety without annotations or garbage collection by using compiler-managed data stacks, making it faster and more memory-efficient than established systems languages. Originally reported…
Goose outperforms C++ and Rust
Goose runs 3.3x faster than idiomatic C++, 1.16x faster than hand-optimized C++, and 1.12x faster than safe Rust while using significantly less memory across 16 benchmarks.
No heap, no garbage collector
Goose eliminates heap allocation, garbage collection, reference counting, and destructors. Memory is managed through compiler-assigned data stacks where freeing a million-element structure takes just one store operation.
Memory safe with zero annotations
The compiler infers reference roots and rejects references that could outlive their owners, eliminating lifetime syntax, aliasing rules, and unsafe code while maintaining full memory safety.
References survive array growth
When a growable array expands, references into it remain valid because growth only advances a pointer without moving existing elements. This eliminates the reallocation problem that plagues C++ vectors.
“A reference into a growing array stays valid for as long as the array does.”
Nested data stays inline
Strings, arrays of strings, records with variable-size fields, and arrays of records are each one contiguous block with no pointers. A 160-byte C++ order becomes 29 bytes in Goose with zero allocations.
Enums sized for their variant
Variable-mode algebraic data types give each value exactly its variant's size rather than the largest one's, saving 4x memory and doubling speed compared to Rust enums in benchmarks.
Narrow relative references
A relative reference stores a typed, checked link as a 1, 2, or 4-byte offset instead of a full pointer. Structures built from them are position-independent, so your data structure is already its file format.
Built in place, guaranteed
A value is constructed at its final destination through any depth of calls. Pushing a parsed record straight into an array or returning a growable array by value costs nothing.
“items.push(parse(line)) writes the parsed record straight into the array”
Return errors across call frames
Return an error from any function up the call stack without Result types, unwinders, or question marks on every call. The compiler statically checks that every call lies inside the target function.
Threads share nothing
A worker thread is compiled as a separate program with its own memory. Values cross through typed queues as a memcpy. Data races, locks, atomics, and memory orderings do not exist in the language.
Generics with zero overhead
Untyped parameters are generic. Function values are compile-time entities, so filter and map compile to the exact loop they look like and build results straight into their destination.
Plain C in and out
Goose compiles to one C file, runs wherever a C compiler does, and calls C directly through extern functions. The bundled TinyCC backend compiles and runs programs in-process with no build step.
One memory model: stacks
A program has the native call stack, static data, and N data stacks. A data stack is a large address-space reservation with a bump pointer. At most one resizable value is live per stack and it is always on top.
Data becomes file format
Self-relative links mean data means the same thing wherever it sits. Saving is writing bytes, loading is reading them back with verification. Corrupt or hostile files return false, never a wild reference.
Trade-offs you accept
You think about where data lives and who owns it. Recursive functions cannot keep growable data across calls. Variable-size arrays iterate but do not index. No escaping closures or dynamic dispatch beyond ADT tags.
Build and run Goose
Goose requires CMake 3.20 or later, a C++20 compiler, and Python 3. Clone the repository, build with CMake, and run programs directly from source or generate C and compile with any C compiler.
New language, mature implementation
Goose is a whole-program compiler of about thirty thousand lines of C++, with specification, standard library, twenty-eight samples, and a test suite running on Windows, macOS, and Linux.
Built with AI assistance
The Goose compiler was implemented almost entirely with AI from a human language design by Wouter van Oortmerssen. Claude Fable handled compiler implementation, benchmarking, and documentation.
The headline
Goose achieves memory safety without annotations or garbage collection by using compiler-managed data stacks, making it faster and more memory-efficient than established systems languages.


