need compression?

30 views
Skip to first unread message

lifei...@gmail.com

unread,
Aug 3, 2018, 12:43:19 PM8/3/18
to kryonet-users
my app serialize objects in Kryo and record it in DB. And my app will communicate with Kryonet. I tried to compress it with Snappy after serializing with Kryo. However,  the test code means Kryo does not need compression. Does Kryo compresss internally? Is Kryonet the same? is it faster than Snappy?

User u = getRandomUser();
//2216 bytes
System.out.println("object size:" + ObjectSizeCalculator.getObjectSize(u));

byte[] serialized = serializeByKryo(u);
//1708 bytes
System.out.println("serialized size:" + serialized.length);

byte[] compressed = Snappy.compress(serialized);
//1713 bytes
System.out.println("compressed size:" + compressed.length);

Nate

unread,
Aug 5, 2018, 2:26:15 PM8/5/18
to kryone...@googlegroups.com
KryoNet just uses your Kryo serializers. You can configure your serializers to do compression, but that is not done by default. Eg:
https://github.com/EsotericSoftware/kryo/#compression-and-encryption

I don't know Snappy. Likely Kryo data will compressed reasonably well.


--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users
---
You received this message because you are subscribed to the Google Groups "kryonet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryonet-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

lifei...@gmail.com

unread,
Aug 17, 2018, 7:21:36 AM8/17/18
to kryonet-users
thanks.  snappy seems unnecessary with Kryo or Kryonet.
Reply all
Reply to author
Forward
0 new messages