BadOptimizations

BadOptimizations

18M Downloads

Can you

Closed this issue ยท 14 comments

commented

replace all string occurrences with string_builders cause every use of strings goes straight into memory, and then it grows exponentially due to having to overwrite each occurrence every time text is entered or read.

commented

What

commented

its using more memory than world gen in 1.20.1+

commented

Have you tried FerriteCore

commented

yeah it helps a tiny bit but adds upfront costs.

commented

Like...?

commented

it just costs a little memory upfront, all mods do

commented

I have been searching for a couple of hours for a memory mod, and the only one that is any good is not fixing it.

commented

FerriteCore saves memory in a list of ways you can read here.

commented

Speaking of that, if you really want to know what takes up so much CPU/memory, use F3 + L to activate a profiling log, run around and stuff until it's done, then take a look at the ZIP file it generates.
Or attach it here and I'll look it.

commented

and then it grows exponentially due to having to overwrite each occurrence every time text is entered or read.

Also, this is incorrect. You can hold a reference to a string of text for as long as you want. Thanks to Java's string pools, a string constant like "hi_there" only has one instance. String concatenation is what takes CPU/memory time. Barely at all, though.

commented

ok, I found out which mod was causing the issue out of my 3 mods...

commented

a mod was claiming increased fps, and it does so, at the cost of memory and ticks

commented

ty for chatting