AmbientSounds 6

AmbientSounds 6

68M Downloads

Large amount of memory churn from continuous regex recompilation

ChiefArug opened this issue ยท 1 comments

commented

Here:

if (biome.tags().anyMatch(x -> x.location().toString().matches(".*" + name.substring(1).replace("*", ".*") + ".*")))

You use String#matches to check against a regex. Instead of doing this, you should precompile the pattern using Pattern.compile and then match against that.

Spark allocation profiler profile: https://spark.lucko.me/6iBBfT022g?hl=786
The highlighted line is 48mb
Image

Neoforge 1.21.1, playing Craftoria on a server. The profile is a client one.

commented

Thanks for bringing this to my attention. Newest version fixes it.