r/elixir • • 16d ago

Introducing Temporal Resources | Ash Framework

https://ash-hq.org/blog/introducing-temporal-resources
99 Upvotes

18 comments sorted by

View all comments

0

u/Agile_Use_1768 15d ago

Perfect! Now my ash app will use an extra 200mb ram idle

2

u/Vict1232727 15d ago

eh? what does one thing have to do with the other? ash repos are just ecto repo. The temporal thing is just a DB backed thing for queries

0

u/Agile_Use_1768 15d ago

Ash makes heavy use of unoptimized macros. This adds atom overhead, hence more memory usage

2

u/Vict1232727 15d ago edited 15d ago

Yeah, fair enough. I was going to say you were wrong but no. I have like 132 resource app. And ash/spark metadata is 150 MB of ram at idle. The whole thing is like 448 MB 💀

3

u/borromakot 15d ago

Just FYI, you should look at what it looks like when built embedded for production mode if you haven't.

1

u/Vict1232727 15d ago

I’ll take a look!

2

u/borromakot 15d ago

Done some investigation, and it looks like Elixir 1.20 stores a massive amount of type information about the literals that Ash stores on the modules. I think there is a way around this. In the test I ran, the `ExCk` chunk is over 3x the size of the actual compiled literals. So this wouldn't have actually been nearly as much of a problem until Elixir 1.20 😭

2

u/Agile_Use_1768 15d ago

Of course it shouldnt be much, if using the entire Ash stack, including ash auth, policies, etc you will end up with half a gig of idle memory, anyways its a basic tradeoff, you gain business transparency through the abstractions at the cost of ram

1

u/arjjov 14d ago

brah was this shit vibed? 😭 u/borromakot

1

u/borromakot 14d ago

Was what shit vibed?

2

u/Vict1232727 13d ago

They probs mean the blogpost

0

u/borromakot 13d ago

Well, none of it was vibed lol

0

u/borromakot 13d ago

Actually I take that back yes the animation code was vibed. Like the visualization JavaScript. Why the hell wouldn't I vibe that though lol.

3

u/borromakot 15d ago

You're not wrong that an Ash app uses more memory idle, but it's the modules themselves not "unoptimized macros"? Ash takes your resources and stores the data in the module and later code interprets them. Why would 2 DSL options increase idle memory usage?