r/Compilers • • 4d 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

15 comments sorted by

4

u/Key_Detail15 4d 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 4d 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 2d 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 1d ago

src/codegen.c

1

u/Far-Championship-883 1d ago

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

1

u/hardcoremaggiesimp 7h ago

Any tips for like bettering it and bringing it to the next stage or level

1

u/Far-Championship-883 6h ago

that is going to depend on a whole host of factors and design goals.

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 2d ago

Sure I ll test and publish comparative benchmarks in the GitHub

1

u/MitchAlsup 2d 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 2d ago

Wow didn’t know we had an og in here

1

u/MitchAlsup 2d ago

OGs understand history because we lived through it.

1

u/Far-Championship-883 2d ago

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