Reduced dynamic memory allocation in Hemisphere.add and other places by ~50 MB/s (~90%).
Improvements:
Prevent allocating hundreds of new TagDelegates each update by using Identifier as map keys.
Prevent allocating many new ConcurrentHashMap$Node each update by using replaceAll((block, count) -> 0) instead of clear()
Replaced deprecated TagRegistry.block and TagRegistry.create with TagFactory
Replaced atmosfera$environmentContexts.computeIfAbsent with one time map initialization
Using ConcurrentHashMapreplaceAll() instead of clear() will keep all created Nodes around forever, but I don't think that'll be an issue since there are very few and they need little memory.
I've tested this somewhat, blockTags do seem to work but maybe I am missing something since I am not sure why the code was using TagDelegates in the first place. Also I did not find any use of biomeTags so I could not test it.
Reduced dynamic memory allocation in
Hemisphere.add
and other places by ~50 MB/s (~90%).Improvements:
TagDelegate
s each update by usingIdentifier
as map keys.ConcurrentHashMap$Node
each update by usingreplaceAll((block, count) -> 0)
instead ofclear()
TagRegistry.block
andTagRegistry.create
withTagFactory
atmosfera$environmentContexts.computeIfAbsent
with one time map initializationUsing
ConcurrentHashMapreplaceAll()
instead ofclear()
will keep all created Nodes around forever, but I don't think that'll be an issue since there are very few and they need little memory.I've tested this somewhat,
blockTags
do seem to work but maybe I am missing something since I am not sure why the code was usingTagDelegate
s in the first place. Also I did not find any use ofbiomeTags
so I could not test it.