GlobbyPotato / Rockhounding_Chemistry

The purpose of Rockhounding Chemistry is to assembly and maintain an industrial area in which several machines handle various types of ingredients (solid, fluid and gaseous) to produce advanced material for mid-late game stages. It also leads to several features, functional applications and experiments.
Other
15 stars 17 forks source link

com.gobblypotato.rockhounding_chemestry.machines.recipe.construction.chemicalextractor.getIput using a TON of CPU #104

Open barcharcraz opened 5 years ago

barcharcraz commented 5 years ago

Looking at the source code it looks like this is returning a new COPY of the item stack every time it's called. I suspect this is the problem, but I don't know who owns the item stack.

This function is showing up really, really high in my profiles for both loading and client thread gameplay.

GlobbyPotato commented 5 years ago

Will give that a look, thanks.

slava110 commented 3 years ago

I can confirm: ItemStack creation in recipe inputs/outputs is taking a lot of time. It depends on ItemStack capabilities tho. More capabilities you have in your modpack - more time it'll take to stop integrated server / leave dedicated server. Basically when client is leaving server TooltipEvent being posted. And that's where GlobbyEventHandler#handleTooltip will try to collect all tooltips. And as your recipe system is giving copy of each ItemStack (in Chemical Extractor Recipe for example) it will try to create new ItemStack, collect all capabilities via Forge event and slow down everything.