Optimize Databoard ModifiedUTF8StringSerializer with more direct byte[] deserialization
Reading values from the Simantics database deserializes byte[]
data and most implementations of Serializer.deserialize(byte[])
just invoke Serializer.deserialize(DataInput)
which naturally causes even more memory allocations to wrap the byte[]
array.
For ModifiedUTF8StringSerializer, this path ends up performing completely unnecessary empty byte[] and char[] array allocations in UTF8.readModifiedUTF(DataInput in, int utflen)
, even if it is completly obvious that the serialize string is empty.
Two optimizations:
- Decode strings directly from
byte[]
- Avoid all unnecessary work decoding
""
Also all other primitive or primitive array type NonRecursiveSerializers could see minor benefit in implemeting direct byte[] deserialization.
Edited by Tuukka Lehtonen