LambdAurora / LambDynamicLights

A dynamic lights mod for Minecraft on Fabric Loader.
https://modrinth.com/mod/lambdynamiclights
Other
401 stars 98 forks source link

Cache nightconfig values to avoid repeated expensive operations #83

Closed magicus closed 2 years ago

magicus commented 2 years ago

Nightconfig uses extremely expensive operations to get simple configuration values. Cache these in local variables instead.

This resolves #80. I have verified using JFR that the 1% CPU spent on nightconfig accesses has disappeared.

LambdAurora commented 2 years ago

Latest commit introduced config value caching, but with a very different implementation since I also wanted to support it for individual entity toggles. Performance-wise it should bring the same improvements as this PR.

magicus commented 2 years ago

Fine by me. Thanks for fixing this.