aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoBench/Program.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-06-10 18:01:34 -0500
committerrogerk <devnull@localhost>2011-06-10 18:01:34 -0500
commit4dc0dfb1546998b15a5e98d5dde6154d463365f2 (patch)
tree2dc8961df1e5c67e215c5e119a2989ba04a58511 /src/ProtoBench/Program.cs
parentddb74eb6a45e758f6690f237fdf60b98d76e02fb (diff)
downloadprotobuf-4dc0dfb1546998b15a5e98d5dde6154d463365f2.tar.gz
protobuf-4dc0dfb1546998b15a5e98d5dde6154d463365f2.tar.bz2
protobuf-4dc0dfb1546998b15a5e98d5dde6154d463365f2.zip
Added initial DictionaryReader/Writer implementations
Diffstat (limited to 'src/ProtoBench/Program.cs')
-rw-r--r--src/ProtoBench/Program.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ProtoBench/Program.cs b/src/ProtoBench/Program.cs
index 2239fe08..34860f33 100644
--- a/src/ProtoBench/Program.cs
+++ b/src/ProtoBench/Program.cs
@@ -137,6 +137,10 @@ namespace Google.ProtocolBuffers.ProtoBench
new JsonFormatWriter(temp).WriteMessage(sampleMessage);
string jsonMessageText = temp.ToString();
+ IDictionary<string, object> dictionary = new Dictionary<string, object>(StringComparer.Ordinal);
+ new DictionaryWriter(dictionary).WriteMessage(sampleMessage);
+
+
//Serializers
if(!FastTest) RunBenchmark("Serialize to byte string", inputData.Length, () => sampleMessage.ToByteString());
RunBenchmark("Serialize to byte array", inputData.Length, () => sampleMessage.ToByteArray());
@@ -145,6 +149,7 @@ namespace Google.ProtocolBuffers.ProtoBench
RunBenchmark("Serialize to xml", xmlMessageText.Length, () => new XmlFormatWriter(new StringWriter()).WriteMessage(sampleMessage));
RunBenchmark("Serialize to json", jsonMessageText.Length, () => new JsonFormatWriter(new StringWriter()).WriteMessage(sampleMessage));
+ RunBenchmark("Serialize to dictionary", sampleMessage.SerializedSize, () => new DictionaryWriter().WriteMessage(sampleMessage));
//Deserializers
if (!FastTest) RunBenchmark("Deserialize from byte string", inputData.Length,
@@ -168,6 +173,7 @@ namespace Google.ProtocolBuffers.ProtoBench
RunBenchmark("Deserialize from xml", xmlMessageText.Length, () => new XmlFormatReader(xmlMessageText).Merge(defaultMessage.WeakCreateBuilderForType()).WeakBuild());
RunBenchmark("Deserialize from json", jsonMessageText.Length, () => new JsonFormatReader(jsonMessageText).Merge(defaultMessage.WeakCreateBuilderForType()).WeakBuild());
+ RunBenchmark("Deserialize from dictionary", sampleMessage.SerializedSize, () => new DictionaryReader(dictionary).Merge(defaultMessage.WeakCreateBuilderForType()).WeakBuild());
Console.WriteLine();
return true;