Embeddium

Embeddium

37M Downloads

[1.18.2] Block lag when using ConnectedTexturesMod

emoticone11 opened this issue ยท 10 comments

commented

I use Embeddium on a modded 1.18.2 server that relies on the Forge ConnectedTexturesMod (as well as our own extension that adds some additional CTM categories).

With both Embeddium and CTM, I occasionally get significant lag when placing or breaking blocks. Removing either Embeddium or the CTM mods fixes the lag. Turning on "always defer chunk updates" in the performance settings also fixes the lag when placing or breaking blocks, but makes the blocks take a fairly long time to render.

Reproduced using:

The lag occurs with seemingly any block, not just those that have CTM associated. For instance, I replicated the issue using minecraft:stone.

commented

Here are profiles taken with and without Embeddium respectively:

https://spark.lucko.me/afAwcUPrgd

https://spark.lucko.me/SBDMeln0YD

commented

This was previously reported to me (by the Westeros team, actually) and when I looked into it I found that the lag occurs within their CTM plugin, not within Embeddium.

The lag will occur whenever placing a block in a chunk that also has CTM blocks, as the whole chunk is rerendered when placing one block.

commented

However, if you have a client Spark profile with the lag, I can take a look again...

commented

Thanks for the quick reply - I wasn't sure if anyone from the Westeros team had already mentioned it. It makes sense that the CTM mod would add some latency, but it seems to be greatly compounded with Embeddium vs. without. I will update with a Spark profile soon.

commented

It looks like these profiles were taken using /spark rather than /sparkc, so they didn't capture any rendering data. The command I would suggest using to start it (if I remember correctly) is

/sparkc profiler --start --thread *

so that it captures all the chunk builder threads, and not just the main thread.

commented

Oh, also, do you have a save file I can use for testing? I tried placing some blocks from this mod in a test world and didn't notice any lag.

commented

Ah, I was having some trouble with /sparkc, but I downgraded to an earlier version of Spark and it worked.

Here are the client profiles with and without Embeddium respectively:

https://spark.lucko.me/urcUGgws4d

https://spark.lucko.me/DdxbR4hit7

And the save file I was using for testing:

https://www.dropbox.com/scl/fi/4lm7z1fo3kldafsr8k0q1/New-World-1.zip?rlkey=4vnj4hj8ou1yrqnhhwt0k6eiw&dl=0

commented

The lag appears to be more noticeable when playing on the WesterosCraft server with the full modpack, presumably due to the higher density of CTM blocks in the chunks being rendered. I've taken client profiles with and without Embeddium on there as well:

https://spark.lucko.me/qMCd2ovLpA

https://spark.lucko.me/G40BjHa7WK

commented

I looked at these profiles and I am still not sure the issue is my fault, or that I can do anything to improve it from my end. If we compare the relevant sections of the profile with/without:

...after expanding, you can see that the lag is caused by the WesterosCTM mod either way, and the chain does not seem to end with a bottleneck on an Embeddium function. I think fixing this would require optimizations to be made within WesterosCTM.

It's worth noting that on 1.18+, I believe vanilla enables some variant of "Always Defer Chunk Updates" by default, unlike Embeddium. This might explain why removing Embeddium leads to a perceived improvement.

commented

I think you might be right that the perceived improvement is due to vanilla deferring chunk updates by default. It seemed to me initially that using Embeddium resulted in higher latency in rendering blocks with that option enabled as well, but I haven't been able to consistently replicate that in my recent tests.

In that case, I'll try to see if any optimizations can be made in the WesterosCTM mod. Thanks again for looking into this.