Renews.
← IT

Goose Language Claims Faster Speed and Lower Memory Use Than C++ and Rust

The Goose programming language presents benchmarks showing it outperforms C++ and Rust in speed and memory efficiency while maintaining memory safety without a heap.

IT·1 source
Photo: Egle_pe / Pixabay

The Goose Programming Language is a memory-safe systems language that does not use a heap allocator, garbage collector, or lifetime annotations. According to the repository's benchmarks, Goose runs faster than C++ and Rust while using less memory. Over sixteen benchmarks show Goose running at 3.3 times the speed of idiomatic C++, 1.16 times hand-optimized C++, and 1.12 times the best safe Rust. In the same benchmarks, Goose uses 1.9 times less memory than idiomatic C++, 1.3 times less than hand-optimized C++, and 1.2 times less than the best safe Rust.

Goose has syntax familiar to C and Rust programmers but contains no heap. In Goose, every dynamic value lives inline on data stacks managed by the compiler. Goose's type and lifetime rules make its memory model safe to use without annotations. Goose has no allocator, garbage collector, reference counting, or destructors. Memory in Goose consists of a handful of data stacks that the compiler assigns statically. Freeing a structure with a million elements in Goose takes a single store regardless of nesting depth.

Goose preserves references during growth so that a reference into a growing array stays valid for as long as the array does. Goose is memory safe with zero lifetime syntax, aliasing rules, exclusivity rules, or unsafe code. The compiler in Goose infers what every reference is rooted at and rejects references that could outlive their owners. In Goose, nested data such as strings, arrays of strings, and records with variable-size fields are stored as one contiguous block containing no pointers. An example record taking 160 bytes and one allocation in C++ takes 29 bytes and no allocations in Goose.

Goose's variable-mode ADTs store each value at the size of its own variant rather than the largest variant, using 4x less memory than a Rust enum on a specific benchmark. Goose uses links narrower than pointers, storing relative references as 1, 2, or 4-byte offsets. Structures built from narrow links in Goose are position independent, allowing them to be written to a file and loaded with a single read followed by verification. In Goose, values are constructed in place at their final destination through any depth of calls without copying. Goose supports returning errors across multiple calls statically without needing an unwinder, Result type, or question mark operator.

Sources

Every sentence of this story was checked against facts quoted from these articles. How we make the news

Spotted an error? Tell us

Sign in

Keep the stories you like in your favorites.

Forgot your password?

No account?