CompatibleFieldSerializer performance issue
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
Both CompatibleFieldSerializer & TaggeFieldSerializer typically generate a way
larger byte stream due to :
for (int i = 0, n = fields.length; i < n; i++)
output.writeString(fields[i].field.getName());
However,using FieldSerializer provides zero backward compatibility.
Should there be an optional annotation/setting that allows an "integer-field"
mapping that replaces "output.writeString(fields[i].field.getName())" by
"output.writeInt(fieldId)" ?
Original issue reported on code.google.com by njz...@gmail.com
on 19 Jul 2013 at 6:41
Google Code Exporter commented
Another naive solution to this issue would be using the hashcode of the field
name (given that the hashing algorithm yields a infinitesimal small collision
rate) instead of the fieldname string itself.
Original comment by njz...@gmail.com
on 19 Jul 2013 at 7:11
- Added labels: ****
- Removed labels: ****
Google Code Exporter commented
Just to clarify that I understand your problem correctly:
Currently, when using CompatibleFieldSerializer Kryo does the following (see
the comment at the beginning of CompatibleFieldSerializer):
A header is output the first time an object of a given type is serialized. The
header consists of an int for the number of fields, then a String for each
field name.
So, if you serialize a lot of objects of the same class using this serializer,
all those field names will be written only once. But you say that a generated
byte stream is a way too large. Can you explain under which circumstances it
occurs? May be you have a test case?
-Leo
Original comment by romixlev
on 23 Jul 2013 at 9:17
- Added labels: ****
- Removed labels: ****