It seems like serializing a class into a binary file takes way long than serializing into a json text file.
That seems counterintuitive, because the json text file is usually bigger than the binary file.
Could that be the case?
Are you talking about a struct, a class or both?
Have you done tests to compare both yourself?
It seems odd that using JSON would be faster. But it could be the case!
I have saved both to a JSON and a binary file, the Binary file seems to take way longer.
It’s a class… serialized class, but it really is just an array with a class that is mostly member variables.
The data can be quite big, but even then the JSON conversion worked a lot less slow it seems.
JSON should be faster than BinaryFormatter in all but extreme cases. BinaryFormatter isn’t actually very fast, and its filesizes aren’t small either, but it becomes a bit better the more data being serialized at once. If you really want faster serialization and deserialization speeds though, and smaller filesizes, check out something like MessagePack. ZeroFormatter is also much much much preferable to BinaryFormatter, if you still want to stick to binary.