NBT
NBT copied to clipboard
Store immutable tags internally as plain values
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.