Recalculating lightining is particularly slow on carpenter's blocks
pisto opened this issue ยท 7 comments
I have a big structure made of carpenter's blocks, roughly . I found that updating the lightning of the blocks is particularly slow, and can cause massive lag spikes under the category "chunk update". I'm not very familiar with Java profiler, so I managed only to get a profile with VisualVM without callgraphs, but this graphs seems to support my guess:
Ambient occlusion seems to be the major hog, but even after disabling it there are still noticeable lags. Here are screenshots with AO on and off, walking around with a torch and the dynamic lights mod:.
In the second screenshot it is evident that the lag happens only when crossing boundaries of blocks.
I could reproduce this on linux openjdk 1.8, and windows 7 java 7.
Point me at a version and I'll try it. I don't know exactly mechanics of lighting with AO and not, but honestly those six functions look very redundant. Can you check in other mods how lighting on custom blocks is made?
I don't know how to profile, and the effects of chunk updates on my PC are no where near as pronounced as they are on other players' computers.
As a test, try a much earlier version of the mod and see if it's the same. If it is, I'm not sure it can be fixed apart from trimming out features. But there's always a chance I made a change recently that causes update lag.
Ambient occlusion requires a lot of calculations, and each face has to grab different values. The code is based off vanilla but actually made less redundant and even improved in some places. The lighting updates require that entire chunks re-render, which doesn't help. Have you tried Optifine's multi-core chunk loading? Just a thought.
As far as older versions, try any listed here: https://www.dropbox.com/sh/ahi753oin7zod6b/AABBOiS0z8oDSjtge4YrVY3ca/Minecraft%201.7.10?dl=0
I'd suggest starting with the oldest in the root folder.
Ok, I'll try. I always have the multicore thing on. It's also a fact that vanilla blocks don't take this much to update lighting, I can roam with a torch without problems in caverns for example.
I tried with the oldest version in the folder, no real change. please test yourself on this map: spawn at about 260 1200 with the dynamic lights plugin, hold a torch and walk around in the house.