You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vdf.NET was originally written as an experiment in deserialization performance. It is significantly faster than alternatives like SteamKit's KeyValue and even Json.NET (though I admit Json.NET is far more feature rich).
The test source file is VdfNetBenchmark.cs. I used version Vdf.NET 0.4.1 and the TF2 schema, which is available both in JSON and VDF formats (you'll need an API key to obtain them).
The following are the times taken for 10 iterations of deserializing the schema on an Intel i7-4790k processor.
Vdf.NET (VDF) : 129ms, 501871ticks average
Json.NET (JSON) : 270ms, 1022480ticks average
SK2 KeyValue (VDF) : 340ms, 1255055ticks average
dynamicvolvo=VdfConvert.Deserialize(File.ReadAllText("importantInfo.vdf"));// 'volvo' is a VProperty, analogous to Json.NET's JProperty// Now do whatever with thisConsole.WriteLine(volvo.Value.SSAVersion);// Prints 3
Note the need to use .Value and skip the enclosing property name Steam. This is because root types in VDF are properties, as opposed to objects in traditional JSON.
Deserialization using models
Vdf.NET does not natively support deserializing to models, but this can be achieved indirectly using the Gameloop.Vdf.JsonConverter extension such as: