Bobby

Bobby

4M Downloads

Lag spikes every time a chunk border is crossed.

EquityX opened this issue ยท 6 comments

commented

I have a 1.18.2 server running on 12 render distance with the HermitCraft Season 7 World. It has Fabric-api-0.51.1, Lithium-0.7.9 & Starlight-1.0.2 installed.

Client mods are Bobby-3.1.1, Cloth Config-6.2.62, Fabric Api-0.51.1, Iris Shaders-1.2.4-build.38, Lithium-0.7.9, Mod Menu-3.2.2, Sodium-0.4.1+build.15, Starlight-1.0.2+fabric.89b8d9f. The only setting changed from default is client render distance at 32.

Both client and server are running -Xms16G -Xmx16G -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+AlwaysPreTouch

There are large lag spikes that occur every time a chunk border is crossed. I've been able to recreate the problem every time on multiple devices. The lag spikes are the same regardless of render distance. I also tried running everything on a ram disk to see if it was an io bottleneck & it made no difference. This is also unrelated to gc as far as I can tell.
2022-05-16_18 03 47
Everything is running on a 5950x cpu, 3090 gpu, 64gb of 3600CL18 ram, and a 970 evo plus 1tb ssd.

commented

This is my # 1 issue with using & recommending this mod. If I run along the edge of 2 chunks the game feels horrible. sadly the walkway to my house is along an edge :(
on another note, awesome mod!
only suggestion is a more ordered chunk loading. currently looks like a worm wiggling around loading random chunks in the distance & revealing caves, instead of loading the ones closest (or furthest depending on preference) first. still, great mod (- the lag issue) (fabric 1.19.1)

commented

What a beast of a PC. I have a potato in comparison but same issue. Every time i cross chunk border the pie graph shows that "bobbyUpdate" spikes very quickly. Gets very jittery when using elytra. Maybe just a bit of optimising?

commented

Have y'all tested against Vanilla? The border lag may be the long standing Vanilla issue.

If that's the cause, try to install Starlight mod onto your client as well.

Starlight mod: https://modrinth.com/mod/starlight/

Original issue reported on Mojang tracker: https://bugs.mojang.com/browse/MC-162253

commented

@EterNityCH the comment above by @TprScruffy says: "the pie graph shows that "bobbyUpdate" spikes very quickly". Even thought is true that this bug is a vanilla long lasting famous issue. However TprScruffy tested it with ALT+SHIFT+F3

commented

After replicating the exact setup described by OP, I believe was able to replicate and identify what causes the specific lag spikes they are experiencing.
The issue appears to be in the replacement of real chunks that the server unloads with bobby fake chunks (which all currently happens on the main thread; unlike loading of fake chunks from disk which is already highly optimized). Appears to be dominated by serialization and then deserialization of the block data in the chunk. I'll see if for the next version I can implement a fast copy method and then do the serialization on a background thread.

What a beast of a PC. I have a potato in comparison but same issue. Every time i cross chunk border the pie graph shows that "bobbyUpdate" spikes very quickly. Gets very jittery when using elytra. Maybe just a bit of optimising?

I've tried a lot but I'm unable to get bobbyUpdate to go beyond ~0.07% in the pie chart when just walking around. bobbyUpdate is already highly optimized and should under no circumstances take measurably more than 1/4th of the frame time (e.g. 4.1ms at 60fps, 2ms at 120fps or unlimited) per frame. Please open a separate issue for that and include as much details as possible.

only suggestion is a more ordered chunk loading. currently looks like a worm wiggling around loading random chunks in the distance & revealing caves, instead of loading the ones closest (or furthest depending on preference) first. still, great mod (- the lag issue) (fabric 1.19.1)

Did this last weekend, will also be in the next version. It'll always do closest first because that's the only thing that makes sense: unless you're really high up in the sky, distant chunks won't even render unless there's already path of loaded chunks leading to them.

commented

Fixed in 6c477c3.