Performance consideration

Reading NBT files

Using the NamedBinaryTag.DataFile class, you can do random access on the memory loaded NBT file. All data will be kept in memory and the source file can be closed. It can also be a non-seekable stream.

Using the NamedBinaryTag.TagReader class, you can also do random access. However, in order to do random access, the provided stream must be seekable. If it is not, the class is still usable as a one-way stream tokenizer like XMLReader.

When using NamedBinaryTag.TagReader to read a file, the process is 2 times faster than when using NamedBinaryTag.DataFile and has a lighter memory footprint.

Writing NBT files

Actually, you can only write NBT files using NamedBinaryTag.DataFile.

Last edited Jul 30, 2011 at 2:59 PM by MyGoddess, version 1


No comments yet.