Reputation: 73
I have recently upgraded the .NET framework on my machine to .NET 4.6 and have noticed a big difference in times of binary (de)serialization of objects from/to files.
For example, I have a 10MB file which was deserialized in ~2 seconds on my machine with .NET 4.5.2. After upgrading to .NET 4.6 it takes up to 50 seconds(!) - actual time is pretty random: sometimes it takes 2 seconds, sometimes 50 seconds (same file, same program, even same process).
Has anybody else noticed similar behavior and maybe found a workaround (or solution) for this issue?
Upvotes: 5
Views: 1403
Reputation: 3003
We encountered exactly the same problem with the BinaryFormatter
when deserializing objects. As we observed this is due to a bug in framework 4.6 which is resolved in framework 4.6.1. The list of changes are found here. The offending bug is Improved performance of parallel binary file deserialization [141896].
Upvotes: 0
Reputation: 941277
Little reason to assume it has anything to do with binary serialization, it is pretty deterministic. Given the random behavior and the likelihood that you'll poke the garbage collector pretty heavily with a 10 megabyte file, a very good candidate is this bug. Quite a doozy.
If you have a good repro then use the new Diagnostics Tools to see any slow gen #1 collections. And tinker with GCSettings.LatencyMode, if it has an affect then you know it is the underlying cause. Should be fixed soon.
Upvotes: 5