Optimized serializer to optimize kryo object size