Enjoying this issue?
Get tomorrow's AI & engineering digest in your inbox — hand-picked, summarized, and always spam-free.
TLDR
Goose's claimed performance advantage over C++ and Rust is almost entirely due to memory allocation strategy: per-node heap allocation vs stack-based arenas. When C++ and Rust use arenas, the gap drops from 15x to under 2x. The project's own benchmarks warn that the headline ratio rests on the least reproducible rows.
Key points
Goose compiles to C and uses stack-based allocation instead of per-object heap allocation.
In a tree benchmark, Goose (206 ms) is 15x faster than C++ with new/delete (3208 ms).
When C++ and Rust use arena allocation, the gap narrows to under 2x and 1.1x respectively.
Across 16 benchmarks, Goose claims to be 3.5x faster than idiomatic C++ and 1.25x faster than expert C++.
The project's own benchmarks warn that the headline ratio depends on the least reproducible rows.
Tools mentioned
Techniques
- stack-based memory allocation
- arena allocation
- per-object heap allocation
Stop scrolling. Start reading smarter.
Receive the day's most important AI & engineering updates in one concise email. No spam.
Transcript (captions)
Goose compiles to C, yet it runs a tree benchmark in 206 milliseconds, where C++ takes 3,208. So, how's anything faster than the language it turns into? These are the
project's own timings from a single machine. The obvious guess is a compiler that writes cleverer C than you would. The README points somewhere else, memory. In that C++ version, every node
gets its own new and later its own delete. That's two trips per node to the allocator, the code that hands out memory and takes it back. Goose has no general heap, values that can grow live
on a few data stacks. Each one's a big reserved stretch of address space with a pointer at the top. Need room, the pointer moves forward. That's the allocation. When a scope ends,
everything it made goes at once. One write sets the top back where it started. There's no free per object and memory never moves. You can test that inside C++ itself. Same trees, but the
nodes come out of one vector, an arena. 3,208 milliseconds drops to 393. Rust splits the same way, about 3,100 with a box, one heap allocation per node and 235 with an arena. Goose sits at
206. Do the division and against plain new and delete, Goose is more than 15 times faster. Against the C++ arena, just under two. Against Rust's arena, about 1.1.
Rows like this carry the project's headline. Across 16 benchmarks, its latest run puts Goose at about three and a half times idiomatic C++ and about one and a quarter times expert C++.
Its own results file calls these allocator-heavy rows the least reproducible in the suite and says they're what the headline ratio rests on. It's a benchmark that ships with its
own warning label. So, on the project's own numbers, the gap is mostly memory. If your C++ does a new per object, these numbers are about you. If you already use arenas, the lead's a lot smaller.
Read the arena row before the headline, which leaves the question that decides it. Who wrote the C++ it's measured against?