SFSObject expensive serialization size

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Posts: 116
Joined: 15 Mar 2011, 04:43

SFSObject expensive serialization size

Postby grhwood » 03 Jul 2015, 19:10


I tested SFSObject serialization with an empty SFSObject and result in 3 bytes, but with empty byte[] it is 11bytes.

Here is my test code:

Code: Select all

SFSObject sfsObject = new SFSObject();
      sfsObject.putByteArray("1", new byte[] {});

Is it too much overhead ?

User avatar
Site Admin
Posts: 21723
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSObject expensive serialization size

Postby Lapo » 04 Jul 2015, 07:39

Data types need to be identified and keys for each entry also take up a few bytes, depending on their string length.
If you want to squeeze every possible byte, you can put all of your data in an SFSArray which uses only indexes.

Additionally SFS2X can compress your packets when their size is greater than a certain threshold. By default it is 1024 byes. Applying compression to smaller data may not provide much advantage.

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Aldenea, DerikFent, Google [Bot], JerodSa and 24 guests