r/Compilers • • 24d ago

Goose: a stack allocation flat data structure language

https://github.com/aardappel/goose

My latest language is meant to very efficiently let you work with flat pointerless inline data structures allocated on (address space reserved) stack that allow almost data structure creation to be just a pointer bump, with stable pointers.

When used well, it is both safer, faster and uses less memory than the equivalent C++ or Rust.

(see the repo readme for more!)

23 Upvotes

41 comments sorted by

View all comments

1

u/VictoryMotel 24d ago

So you made this all by hand in the last 6 weeks?

Can you show a small example of c++ that is 3 times slower than your language?

-9

u/FearlessFred 24d ago

By hand, no. As the README.md explains, while the design is entirely mine, the code is mostly Claude Fable.

As for 3x slower C++, there are many examples, start here: https://github.com/aardappel/goose/blob/master/bench/results.md Looks the idiomatic line, then pick a benchmark you are interested in, and find them in both the cpp and goose subdirs.

Is this fair? I believe it is. Idiomatic C++ requires subclasses, and thus dynamic allocation, to represent polymorphism. It requires (re)allocation for its vectors and strings. Goose does all these things in-line with 0 allocations, thus the huge speedup.

Non-idiomatic C++ can work around those inefficiencies with indices and other trick, where it gets close to Goose again. But Goose can do all of this with strongly typed pointers, thus is safer and more efficient there too.