-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace FST #1033
Comments
FST has shown some life (though the Android issues are not fixed), so maybe we can delay this a bit. |
FYI I use https://github.com/EsotericSoftware/kryo (binary serialization) for StreetComplete, it's maintained, uses reflection to serialize the members. Using this https://github.com/westnordost/StreetComplete/blob/master/app/src/main/java/de/westnordost/streetcomplete/util/KryoSerializer.java for configuration, I can call Date myDate = new Date();
byte[] dateBytes = serializer.toBytes(myDate);
Date thatSameDate = serializer.toObject(dateBytes, Date.class);
assertEquals(myDate, thatSameDate); The only thing you'd have to look out for are that you never delete any of the registered classes, even changing the order of the members declaration of the registered classes will be a problem, as with probably any serialization to binary. I once had problems with serialization because Proguard tossed out an unused member variable from one of these classes, which resulted in that the serializer would de-serialize those that have been serialized before Proguard tossed out the unused member variable wrongly. For this source of error, if I could go back in time, I would have chosen JSON serialization (with GSON or Moshi) over binary because what are a few bytes saved over such a problematic and non-obvious source of error? |
@westnordost the alternative alternative is simply to serialize manually, I've just simply been a bit adverse to doing the, lot of, work involved. |
How about Kotlin serialization? |
FYI StreetComplete uses Kotlin Serialization (to/from JSON) now. I chose serialization to/from JSON because it is easy to switch out the implementation if the particular library one is using should not be used anymore for whatever reason. |
See
and
RuedigerMoeller/fast-serialization#288
As FST seems to be deader than dead just 1 year after we switched to it, we need to replace it. Since this is key functionality for the app, it seems to be unwise to rely on any third party and we should simply role our own for at least the key objects that we need to save and restore.
The text was updated successfully, but these errors were encountered: