LockerGnomeFor serious tech professionals with a silly side.
Subscribe

Search

Softwareprogramming-languagesaiperformance

Goose, a Programming Language With No Heap, Was Designed by FlatBuffers' Creator and Built by Claude Fable

Wouter van Oortmerssen shelved his design for a memory-safe language that keeps everything on compiler-assigned stacks, then had Claude Fable write the compiler. His benchmarks put it ahead of idiomatic C++ and safe Rust.

Chris lifts the top tray off a tall, neat stack of trays while a small white goose looks up from its base.
Illustration: LockerGnome

The pitch fits in one line of the README: “there is no heap.” Every dynamic value in a Goose program “lives inline on data stacks managed by the compiler. Growth advances a pointer, and memory is freed when its scope ends.”

That’s the whole memory model. “No allocator, no GC, no reference counting, no destructors,” the README says. “Freeing a structure with a million elements takes a single store, no matter how deeply it is nested.”

The designer has form. Wouter van Oortmerssen (@wvo) is the person behind “the serialization library FlatBuffers,” the Lobster game language, Amiga E, the False esolang and the Cube engines, and he worked on WebAssembly at Google. Goose had been sitting half-built on his desk while he ran a game studio.

“I had designed Goose several years ago, and had started to implement it,” he writes in the repo, “but running a game startup … there was no time to finish it.” The authors section splits the credit plainly: van Oortmerssen did “Language Design, Compiler Design, Coding standards,” and Claude Fable did “Compiler implementation, Benchmarking, Sample & Doc writing.”

He hadn’t expected that to work. “I had not expected AI to help with this until Fable came out,” he writes. He had it “clone the style and structure” of his Lobster compiler, and the back and forth forced him to settle what his old design had left open: “it is now a better language for it.”

The tricks fall out of the stacks. Only one resizable value is live per stack, always on top, “so growth never moves anything and never checks a capacity.” A reference into a growing array stays good after a million pushes, which std::vector and Rust’s Vec can’t promise because they reallocate.

Nested data stays flat, too. The README’s sample order record, a customer name plus two line items, is “29 bytes and 0 allocations” in Goose. As C++ std::string plus std::vector<Item> “it is 160 bytes and 1 allocation, and as Rust String + Vec<Item> it is 153 bytes and 4 allocations.”

Then the speed claim. “Over sixteen benchmarks Goose runs at 3.3x the speed of idiomatic C++, 1.16x hand-optimized C++ and 1.12x the best safe Rust.” The generated results file, dated October 16 and run on a Ryzen 9 9950X3D, has slightly different geometric means: 3.51x idiomatic C++, 1.24x the hand-built C++ and 1.13x Rust on the MSVC build. These are the project’s own numbers, from one machine.

To its credit, the same file keeps the losses on the page. “calc takes 481/491 ms against the Rust arena’s 436 ms,” and lru and scene lose to Rust under MSVC while tying or winning under clang. The README admits the bill, too: an array of variable-size records “is sequential: you can iterate it but not index it.”

The compiler is about thirty thousand lines of C++, emits one C file, and ships a TinyCC backend so goose file.goose runs with no build step. Moves for resizable values, more than one resizable per struct and labeled break are all still on the to-do list. So is the line van Oortmerssen tossed in about rewriting the compiler in Goose itself: “that may still happen.”

Shelved side projects are about to get unshelved. Every senior engineer has a design doc they never had a spare year for, and the design was always the scarce half. The coding half just got cheap enough to finish on nights and weekends.

The catch is trust. A language is only as good as its benchmarks are honest, and these were written by the same model that wrote the compiler. Independent reruns on other machines, and a first real program from someone who isn’t its author, are what to watch for next.

More Software

Every Software story →