Size of a serialized null values
Asked Answered
D

1

10

I have to send through the network a complex object which references are almost all of them Null, but I wonder about the size of this object with this null references inside.

Which is the size of a null value contained in a serialized object?

I am evaluating if it is better to change the communication protocol, sending a simpler object, at the cost of not reusing the complex one, and make several simple one for each kind of communication I have.

Daren answered 5/12, 2011 at 10:16 Comment(1)
This is really easy to find out. Serialize an object to a file and look how large the file will be. Compare this to how large the file is when you serialize a special data transfer object which doesn't contain the extra fields.Traipse
U
13

The null itself should be 1 byte (0x70) as seen from Object Serialization Stream Protocol

Unavailing answered 5/12, 2011 at 10:32 Comment(1)
FWIW I just wrote a small test and indeed it appears to be 1 byte for a null.Influential

© 2022 - 2024 — McMap. All rights reserved.