NBT icon indicating copy to clipboard operation
NBT copied to clipboard

Add a serializer flag to force ordering of TAG_Compound keys

Open dktapps opened this issue 2 years ago • 0 comments

It may be desirable to keep an encoded binary cache of an NBT tree, to be able to do fast bytewise comparison (such comparisons are vectorizable, and as such, considerably faster than making many thousands of equals() method calls).

However, this is currently not a reliable method of comparison, since TAG_Compounds with the same contents can have said contents ordered differently. This doesn't affect the usability of the data in the end, but it does mean that the binary representation would be different.

Use case: I want to have a fast way to compare itemstack NBT when checking item equivalence.

dktapps avatar May 01 '23 12:05 dktapps