EXPLORINEER
en

Hacker News

The Goose Programming Language

SoftwareFirst seen 146 points52 comments


Goose is a new programming language that aims to be memory safe without a heap, garbage collector, or lifetime annotations. In its own benchmarks, it runs faster than C++ and Rust while using less memory.

What happened

A project called Goose has shared its design and test results. Goose is a systems language, meaning a language for building low-level software such as tools and engines. It has syntax that looks like C and Rust, but it does not use a heap. Instead, every value sits inline on a data stack that the compiler manages. Memory is freed when its scope (the block of code where it was made) ends.

Key numbers

  • Across sixteen benchmarks, Goose runs at 3.3 times the speed of idiomatic C++.
  • Goose runs at 1.16 times the speed of hand-optimized C++.
  • Goose runs at 1.12 times the speed of the best safe Rust.
  • Goose uses 1.9 times less memory than idiomatic C++, 1.3 times less than hand-optimized C++, and 1.2 times less than safe Rust.
  • A 160-byte record in C++ takes 29 bytes in Goose, and Goose needs no separate allocation for it.

How the memory model works

Most languages use a heap, a shared pool of memory that is requested and released while a program runs. Some languages use a garbage collector to clean up unused heap memory. Goose uses neither. The compiler plans where each value lives ahead of time, so freeing a large structure takes just one step. Goose also keeps data together in one block, with no hidden pointers inside, so it is fast and compact.

Why it matters

If the claims hold up, Goose could offer safety and speed without the extra work that C++ and Rust often need. It shows that memory can be kept safe without a garbage collector or many annotations. The article also notes that the benchmark results include losses, so readers can see where Goose did not win. Still, these results come from the project's own repository, so outside testing will be important.

What to watch

  • Whether independent groups repeat the benchmarks and get similar results.
  • How well Goose handles large, real-world programs beyond the thirty-one sample programs.
  • Whether programmers find the no-heap style easy to learn compared with C and Rust.

Glossary

Goose
A systems programming language that stores all data on compiler-managed stacks instead of a heap.