SpockBotMC / cpp-nbt

C++23 NBT serializer
zlib License
41 stars 4 forks source link

Copy type_name in every Tag might cost much memory #3

Closed mudream4869 closed 3 years ago

mudream4869 commented 4 years ago

A constant string is copied in every tag. It might be a large cost in memory when reading a mca file. https://github.com/SpockBotMC/cpp-nbt/blob/master/nbt/nbt.hpp#L73

nickelpro commented 4 years ago

My experience with NBT is entirely on the protocol side (where NBT is usually < a dozen tags), not actual Anvil files. I'd happily merge a commit that embeds names using a std::string_view or something similar. Or just move the names directly into the pretty printer, which is probably the correct answer. Though I somewhat like the convenience of being able to print a tag's identity directly without having to deference through an array or something.

nickelpro commented 3 years ago

Fixed in rewrite