NBT icon indicating copy to clipboard operation
NBT copied to clipboard

Store immutable tags internally as plain values

Open dktapps opened this issue 9 months ago • 0 comments

This PR implements #126.

The memory usage improvement is very slim according to initial tests - sadly the gains from not allocating the simple tag objects are negated by the losses from having a separate valueTypes array in CompoundTag. Write performance is also marginally worse because of the extra array lookup in CompoundTag->valueTypes.

However, the performance of decoding is improved by about 10%, and equals() is more than 2x faster.

This architecture would favour implementing NBT as a PHP extension, since we'd be able to do considerably more optimizations at the native level than we can here.

dktapps avatar Mar 11 '25 02:03 dktapps