r/Compilers • • 3d ago

low ram usage efficient minimalist compiler

https://github.com/SidMan-alpha-version/slab

read the description for more info feel free to give feedback or contribute to it it has math native operators such as integration and summation also c native so can import any c library i believe

2 Upvotes

13 comments sorted by

4

u/Key_Detail15 3d ago

low ram usage efficient minimalist compiler

So, how low are we talking about? Is this the compiler itself, or for the programs it compiles? Which parts are minimalist?

How does it compare with other languages regarding RAM use?

In the case of user-applications, wouldn't the memory usage depend on the data needs of the application and its users?

(I haven't looked at your project in detail, just picking up on those points you've highlighted.)

1

u/hardcoremaggiesimp 3d ago

Program it compiles and it is relative and I ve explained that on the GitHub so basically we use struct of arrays rather than arrays and other architectural decisions like garbage loading to reduce ram usage

1

u/Far-Championship-883 1d ago

not wholly bad ideas. looks like you're not doing you own codegen though ?

1

u/hardcoremaggiesimp 1d ago

I do own the codegen , and what I m I not doing I think the sentence got cut off

1

u/Far-Championship-883 1d ago

i looked at your repo, where is the codgen code ?

1

u/hardcoremaggiesimp 15h ago

src/codegen.c

1

u/Far-Championship-883 8h ago

ok, looks like a nice toy compiler for a narrow use case, interesting ideas though.

1

u/Discordbothost 2d ago

The layout is hard to separate from the allocator in a cross-language benchmark. I'd run the same loop with array<T> and table<T> in Slab, keeping the row count and workspace lifetime fixed. Report peak memory for both, and say whether the loop reads one field or the whole record.

1

u/hardcoremaggiesimp 1d ago

Sure I ll test and publish comparative benchmarks in the GitHub

1

u/MitchAlsup 1d ago

In 1983 I built an optimizing C compiler that fit in 64KB of PDP-11/70 memory. The target was Denelcor H.E.P processor.

1

u/hardcoremaggiesimp 1d ago

Wow didn’t know we had an og in here

1

u/MitchAlsup 1d ago

OGs understand history because we lived through it.

1

u/Far-Championship-883 1d ago

very cool, i'd love to grab a beer, if you ever in the grand rapids area, shout.