Modular Machinery

Modular Machinery

12M Downloads

canStartCrafting performance problem

GregTecher opened this issue · 2 comments

commented
---ts=2019-10-31 16:48:46;thread_name=Server thread;id=22;is_daemon=false;priority=5;TCCL=net.minecraft.launchwrapper.LaunchClassLoader@1c655221
    `---[5.810541ms] hellfirepvp.modularmachinery.common.tiles.TileMachineController:searchAndUpdateRecipe()
        +---[0.009913ms] hellfirepvp.modularmachinery.common.crafting.RecipeRegistry:getRegistry() #146
        +---[0.009113ms] hellfirepvp.modularmachinery.common.crafting.RecipeRegistry:getRecipesFor() #146
        +---[0.008655ms] java.lang.Iterable:iterator() #152
        +---[min=8.59E-4ms,max=0.023325ms,total=0.160024ms,count=70] java.util.Iterator:hasNext() #152
        +---[min=8.52E-4ms,max=0.006488ms,total=0.118132ms,count=69] java.util.Iterator:next() #152
        +---[min=8.06E-4ms,max=0.012699ms,total=0.1052ms,count=69] java.util.Map:values() #153
        +---[min=0.001293ms,max=0.028329ms,total=0.262163ms,count=69] hellfirepvp.modularmachinery.common.util.MiscUtils:flatten() #153
        +---[min=0.001518ms,max=0.101496ms,total=0.387714ms,count=69] hellfirepvp.modularmachinery.common.machine.DynamicMachine:createContext() #153
        +---[min=0.014718ms,max=0.15412ms,total=2.32764ms,count=69] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext:canStartCrafting() #154
        +---[min=8.41E-4ms,max=0.00372ms,total=0.106496ms,count=69] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:isFailure() #155
        +---[0.002502ms] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getValidity() #163
        +---[min=7.63E-4ms,max=0.013008ms,total=0.114836ms,count=68] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getValidity() #160
        +---[0.058407ms] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getUnlocalizedErrorMessages() #171
        +---[0.008239ms] com.google.common.collect.Iterables:getFirst() #171
        `---[0.002646ms] hellfirepvp.modularmachinery.common.tiles.TileMachineController$CraftingStatus:failure() #170

`---ts=2019-10-31 16:48:46;thread_name=Server thread;id=22;is_daemon=false;priority=5;TCCL=net.minecraft.launchwrapper.LaunchClassLoader@1c655221
    `---[3.361075ms] hellfirepvp.modularmachinery.common.tiles.TileMachineController:searchAndUpdateRecipe()
        +---[0.002642ms] hellfirepvp.modularmachinery.common.crafting.RecipeRegistry:getRegistry() #146
        +---[0.003507ms] hellfirepvp.modularmachinery.common.crafting.RecipeRegistry:getRecipesFor() #146
        +---[0.003153ms] java.lang.Iterable:iterator() #152
        +---[min=9.03E-4ms,max=0.011517ms,total=0.089732ms,count=70] java.util.Iterator:hasNext() #152
        +---[min=9.19E-4ms,max=0.002073ms,total=0.082627ms,count=69] java.util.Iterator:next() #152
        +---[min=7.89E-4ms,max=0.002147ms,total=0.06869ms,count=69] java.util.Map:values() #153
        +---[min=0.001334ms,max=0.013542ms,total=0.131818ms,count=69] hellfirepvp.modularmachinery.common.util.MiscUtils:flatten() #153
        +---[min=0.001606ms,max=0.011224ms,total=0.153322ms,count=69] hellfirepvp.modularmachinery.common.machine.DynamicMachine:createContext() #153
        +---[min=0.01419ms,max=0.137579ms,total=1.345511ms,count=69] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext:canStartCrafting() #154
        +---[min=8.3E-4ms,max=0.002414ms,total=0.073678ms,count=69] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:isFailure() #155
        +---[0.001909ms] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getValidity() #163
        +---[min=7.86E-4ms,max=0.003398ms,total=0.069942ms,count=68] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getValidity() #160
        +---[0.014285ms] hellfirepvp.modularmachinery.common.crafting.helper.RecipeCraftingContext$CraftingCheckResult:getUnlocalizedErrorMessages() #171
        +---[0.001872ms] com.google.common.collect.Iterables:getFirst() #171
        `---[0.001369ms] hellfirepvp.modularmachinery.common.tiles.TileMachineController$CraftingStatus:failure() #170

just installed two mods,ModularMachinery and lagGoggle
I use arthas capture this performance problem
this problem varies by count of recipes,in omnifactory,a signle Microminer can up to 1ms
although i have seen you have try to optfine this with large check interval, obviously, it not work, you should take a more effiency method / way to fix it

(sorry for my bad english : )

commented

In my opinion, a lot of changes are needed to solve this problem
Including new recipe mechanism, various caches and failure checks
It really has a serious impact on the game experience. The entities of other mods are only less than 10us, while a single MM controler takes average 1k+us

commented

Need a java profile of the server to get context, via visualvm or Sampler, along with how long the profiling was run (2 minutes is preferable to 2 seconds, for instance).

Also need a full list of all mods involved and their versions.