GTNewHorizons / GT-New-Horizons-Modpack

New Modpack with Gregtech, Thaumcraft and Witchery
https://www.gtnewhorizons.com/
Other
980 stars 299 forks source link

Big fps lag spikes caused by blockrenderer mod #11977

Closed chochem closed 10 months ago

chochem commented 1 year ago

Your GTNH Discord Username

chochom#0271

Your Pack Version

2.2.7 (+updated tctweaks)

Your Server

SP

Type of Server

None

Your Expectation

no such lag spikes. (btw, I am using optifine E7)

The Reality

steps to reproduce:

  1. start game, fly around, everything is (mostly) fine, no massive spikes.
  2. open up NEI and look at a multiblock preview (lets say CoAL)
  3. fly around the base again. Suddenly there are massive lag spike whenever multis are coming into renderdistance. (its fps. \xu_tps shows that tps are not affected)

(I restarted twice and found the same each time)

control test:

  1. start game without this mod.
  2. never get such large lag spikes

more details from the pie chart in shift+F3: the spike specifically stems from root.tick.level.entities.blockentities with the offender being "checkedPosition < toCheckCount". This one item literally causes the entire spike.

confirmation by others:

Your Proposal

try to fix it. Potentially this might be the cause of some of the other lag-tickets regarding 2.2.3+ but those are not very specified.

Final Checklist

Fiyorin commented 1 year ago

can confirm. tried it 2x and after showing the preview of the DTPF results in big stuttering/fps drops (1-2 seconds). before i could fly through my large base with gravtiy armor+boost key without a hiccup. tested on 2.2.3 without optifine

chochem commented 1 year ago

@Quarri6343 any ideas? there seem to be a lot of people on discord confirming this.

chochem commented 1 year ago

a discord search tells me the problem has been known for a while (just not reported to github) image

and that quarri is somewhat aware image (link is to the madman post above)

I dont know if they looked into it though.

Quarri6343 commented 1 year ago

root.tick.level.entities.blockentities with the offender being "checkedPosition < toCheckCount". This one item literally causes the entire spike.

I didn't touch tileentity ticking in my mod it may caused by other mod that does tileentity ticking in the NEI preview scene...

Quarri6343 commented 1 year ago

a memo https://forums.minecraftforge.net/topic/18396-172unsolved-massive-lags-checkedposition-lt-tocheckcount/

chochem commented 1 year ago

luckily mitch and ALongStringOfNumbers were helping out on discord. For the record:

This is likely caused by not doing this image

specific code being here https://github.com/GregTechCEu/GregTech/blob/master/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java#L73-L86

Will need a fix on the gt5u side.

miozune commented 1 year ago

Hopefully this works http://jenkins.usrv.eu:8080/job/Block-Renderer/8/

chochem commented 1 year ago

that doesn't work sadly. Thanks for trying!

I have gone back to test a bit further. Specifically trying to capture the spike in visualvm. This would be much easier for people with potato PCs I think but I kind of had some success:

CPU hotspots for a single fairly controlled easily reproducable lag spike (aka moving a tiny bit to load in my fusion reactors and a few multis around that) (This is all with the fix attempt version by the way):

First, before using 3d preview. It feels smooth and the 'hotspots' look like this: image

Second, after using 3d preview. It feels like a lag spike and the 'hotspots' look like this: image

I dont know what most of this does but what stands out to me is the gregtech.api.metatileentity.BaseMetaTileEntity.hasValidMetaTileEntity() as that broadly aligns with the previous theory.

Edit: maybe this is BS, I dont really understand VisualVM numbers.

Glease commented 1 year ago

@chochem may I suggest a seemingly completely unrelated experiment? try run /ic2 uu-world-scan small. The client will hang for a few minutes (not literal screen freeze, just that machine GUI won't open, new chunks won't be loaded, stuff like that) and after that you should see similar lags from happening.

chochem commented 1 year ago

I have tried. I only froze for like 10 seconds. I guess the 4 minute message is as old as IC2 :P

However, this did not create such lag for me. Not even a bit.

chochem commented 1 year ago

nice, this is fixed by https://github.com/GTNewHorizons/GT5-Unofficial/pull/1556.

Zefix313 commented 1 year ago

This is still the case for the newest 2.3.0 version. Viewing the multiblock previews like Recipes and Usages still cause massive fps lag spikes every few seconds for the rest of the play time until relaunching the game. The CPU periodically goes up to 100%. Before using the multiblock feature, it constantly rests at 30-40%

chochem commented 1 year ago

with the precise problem described above? 'checkedPosition < toCheckCount' causing the spike? because that was fixed for me.

If its not that, make your own ticket. and analyse it more.

Zefix313 commented 1 year ago

Yes it is 'checkedPosition < toCheckCount' being way too much time consuming. I thought this was fixed long ago

chochem commented 1 year ago

well it was. guess its back

chochem commented 1 year ago

of course in the meantime, the easiest is to just remove the mod. its terrible anyway.

Zefix313 commented 1 year ago

I mean sadly it's a big part of this modpack because it contains all the recipes and the wiki is not up to date

chochem commented 1 year ago

Its not remotely a big part, no. It is very safe to remove blockrenderer, I do it myself. It adds nothing of value really except some (largely) incorrect visuals.

Zefix313 commented 1 year ago

Don't you have to disable the entire Not Enough Items mod?

chochem commented 1 year ago

god no, not NEI. just blockrenderer.