XML vs Binary performance for Serialization/Deserialization

前端 未结 6 1859
迷失自我
迷失自我 2020-12-10 15:03

I\'m working on a compact framework application and need to boost performance. The app currently works offline by serializing objects to XML and storing them in a database.

6条回答
  •  旧时难觅i
    2020-12-10 16:05

    Interesting... thoughts:

    • what version of CF is this; 2.0? 3.5? In particular, CF 3.5 has Delegate.CreateDelegate that allows protobuf-net to access properties much faster than in can in CF 2.0
    • are you annotating fields or properties? Again, in CF the reflection optimisations are limited; you can get beter performance in CF 3.5 with properties, as with a field the only option I have available is FieldInfo.SetValue

    There are a number of other things that simply don't exist in CF, so it has to make compromises in a few places. For overly complex models there is also a known issue with the generics limitations of CF. A fix is underway, but it is a big change, and is taking "a while".

    For info, some metrics on regular (full) .NET comparing various formats (including XmlSerializer and protobuf-net) are here.

提交回复
热议问题