I have the following object:
public partial class Game
{
public bool Finished { get; set; }
public Guid GameGUID { get; set; }
public long GameID { get; set; }
public bool GameSetup { get; set; }
public Nullable<int> MaximumCardsInDeck { get; set; }
public Player Player { get; set; }
public Player Player1 { get; set; }
public bool Player1Connected { get; set; }
public bool Player1EnvironmentSetup { get; set; }
public long Player1ID { get; set; }
public int Player1Won { get; set; }
public bool Player2Connected { get; set; }
public bool Player2EnvironmentSetup { get; set; }
public long Player2ID { get; set; }
public int Player2Won { get; set; }
public int Round { get; set; }
public Nullable<int> RoundsToWin { get; set; }
public bool Started { get; set; }
public string StateXML { get; set; }
public Nullable<DateTime> TimeEnded { get; set; }
public Nullable<int> TimeLimitPerTurn { get; set; }
public byte[] TimeStamp { get; set; }
public Nullable<DateTime> TimeStarted { get; set; }
}
This class gonna be filled with some test data.
I need the to compare the Performance of different Serializers used by the different forms of bindings for WCF Services:
- basicHttpBinding => SoapFormatter (TextFormatter?)
- binaryBinding => BinaryFormatter
- XMLFormatter
What i need to do in detail is:
- Get to now the size of the Object being serialized
- Get to now the size after serizlization
- Time to serialize
- Time to deserialize
I already tried some stuff, but i am struggling a bit.
Maybe there is already some simple code for this kind of measurement.
OK; I’ll bite… here’s some raw serializer metrics (emph: you may need to consider base-64/MTOM to get overall bandwidth requirements, plus whatever fixed overheads (both space and CPU) that WCF adds), however; results first:
(so I conclude protobuf-net v2 the winner…)
Numbers updated with .NET 4.5 and current library builds, on a newer machine:
with test rig (compiled with optimizations, run at command line):
(and note I had to invent the
Playerclass and some sample data):