CaffeineMC / phosphor-fabric

A Fabric mod designed to dramatically improve the performance of Minecraft's lighting engine while fixing many bugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chunk lag & Lag at constant intervals

QPCrummer opened this issue · comments

I made this beautiful picture to demonstrate that phosphor isn't that far away from vanilla, yet in the GitHub Releases it says that you implemented "Fixes for lag spikes that would occur when crossing certain chunk boundaries". I wanted to know if it was just weak hardware or an actual Phosphor issue. (I know it isn't fair to compare Starlight and Phosphor as the approach the issue differently, but I just wanted to remark that even a new lighting engine can't fix this issue)
Phosphor vs Starlight

Sorry for it being so small. You can click on it to zoom in.

It is almost impossible to understand the comparison you're making, because for Starlight, you use a super small render distance of just a few chunks, where as Phosphor is given at or beyond maximum render distance. This means Phosphor has to handle many more chunks being loaded and unloaded when you move around.

It turns out I can't read. Disregard this.

Both are set to 32 chunk render distance

Also, I know it is going to be fairly low fps(as I run an old computer). I was mainly worried about the very sudden lag spikes between chunks.

As described by the change log, the lag spikes Phosphor 0.7 was addressing are in regards to crossing only certain chunk boundaries. The specifics of this are detailed in the aforementioned issue MC-162253. While we try to optimize the lighting engine as best as possible, there is still a lot of work to go, and most of the recent developments have been for worst-case situations.

If this is a new issue between Phosphor 0.6 and 0.7, then there may be a regression we need to look into.

I'll test Phosphor 0.6 then.

It seems to have helped a little I suppose.
Here is from 0.6:
2021-01-07_15 20 43

Could the lag be caused from old hardware. I don't see this happening to people with 5950x (or i9)s and 3090s.

Or is it that they get so much FPS that a dip in FPS isn't noticeable because they are already getting 2,000FPS.

commented

I don't recall having any lag when crossing chunk boundaries (I'm running phosphor 0.6.0 on client). I think this maybe an AMD graphics card issue, as 3090s and my 1660 ti aren't causing issues.

I don't recall having any lag when crossing chunk boundaries (I'm running phosphor 0.6.0 on client). I think this maybe an AMD graphics card issue, as 3090s and my 1660 ti aren't causing issues.

This occurs on my 960 only with specific borders, usually 1 direction only. It's greatly reduced on 0.7.0 though. AFAIK it's CPU related, your gpu shouldn't matter.

I don't have this problem anymore. It is 100% cpu related. I just upgraded my cpu from an FX8350 to a ryzen 7 5800x. I can barely notice it anymore. It still happens when loading into the world, but after about a minute, it is basically non-existent. However, a lot of people can't get their hands on new cpus, so this is still a widespread problem. So I suppose I will keep this open for a little while longer so people see that it is cpu related and not gpu.

commented

Can confirm I actually do have this issue, just that there isn't a lot of lag so i barely notice it (and also probably because I'm accustomed to low fps now)
2021-01-28_07 54 28

I did notice that switching to Java 11 OpenJ9 helped a lot. Then I used the GenconGC instead of the garbage collector that Fabric defaults it to. If you want to (almost) entirely get rid of this issue, I would use Starlight instead. After switching to Starlight the lag spikes was not nearly as frequent.
Also just noticed, I would suggest using Sodium(for more FPS) over Canvas unless you prefer to use shaders. Even then, the Iris Shader's fork of Sodium could run some shaders. I would say that it would get your at least 50+ more FPS.

I have just switched to a custom world generator, Simplex to be exact. It seems to be more of a GPU related issue because I am running my 5800x only at 4% load(I do think it is weird because my fx 8530 would constantly run at 60% load). I think it related to the GPU. It is also strange because it happens at a constant interval, roughly every 2 seconds. It will go from 2 ms to 64 ms.

I have figured out the culprit. It turns out that RX 480s cannot mipmap well, causing lag every 2 seconds when it loads textures. So, the lag goes away when mipmapping is turned to off.

Closing this since the discussion digressed quite a bit and this seems to be a rather general performance issue than anything related to Phosphor.
Phosphor shouldn't interact with the GPU in any way, so the conclusion feels rather strange. It sounds more like this could be caused by frequent GC cycles or something like that. However, I think further troubleshooting is best suited for Discord.
Feel free to open a new report if you have any evidence that Phosphor 0.7.1 still causes any objectively measurable lag spikes that Vanilla doesn't.