diff options
author | csharptest <roger@csharptest.net> | 2011-06-08 11:51:24 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-06-08 11:51:24 -0500 |
commit | c671a4b317fbc77dab57a18d64a67a11d0558378 (patch) | |
tree | 917bcb2ddf3c9c639b70b29a88541c6cec3322ce /src/ProtoGen | |
parent | c2a1f9b538ebd7c0a1cd5a367afd23c4efed7d44 (diff) | |
download | protobuf-c671a4b317fbc77dab57a18d64a67a11d0558378.tar.gz protobuf-c671a4b317fbc77dab57a18d64a67a11d0558378.tar.bz2 protobuf-c671a4b317fbc77dab57a18d64a67a11d0558378.zip |
A few performance tweaks of the ICodedOutputStream interface/implementation
Diffstat (limited to 'src/ProtoGen')
-rw-r--r-- | src/ProtoGen/EnumFieldGenerator.cs | 6 | ||||
-rw-r--r-- | src/ProtoGen/MessageFieldGenerator.cs | 10 | ||||
-rw-r--r-- | src/ProtoGen/PrimitiveFieldGenerator.cs | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/ProtoGen/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs index 3e9e071a..763c18ab 100644 --- a/src/ProtoGen/EnumFieldGenerator.cs +++ b/src/ProtoGen/EnumFieldGenerator.cs @@ -61,7 +61,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer)
{
writer.WriteLine("public bool Has{0} {{", PropertyName);
- writer.WriteLine(" get {{ return result.Has{0}; }}", PropertyName);
+ writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName);
writer.WriteLine("}");
AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
@@ -125,14 +125,14 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateSerializationCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" output.WriteEnum({0}, \"{2}\", (int) {1}, {1}.ToString());", Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}
public void GenerateSerializedSizeCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" size += pb::CodedOutputStream.ComputeEnumSize({0}, (int) {1});", Number, PropertyName);
writer.WriteLine("}");
}
diff --git a/src/ProtoGen/MessageFieldGenerator.cs b/src/ProtoGen/MessageFieldGenerator.cs index b464da20..c5b3a6a5 100644 --- a/src/ProtoGen/MessageFieldGenerator.cs +++ b/src/ProtoGen/MessageFieldGenerator.cs @@ -60,7 +60,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer)
{
writer.WriteLine("public bool Has{0} {{", PropertyName);
- writer.WriteLine(" get {{ return result.Has{0}; }}", PropertyName);
+ writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName);
writer.WriteLine("}");
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}; }}", PropertyName);
@@ -80,7 +80,7 @@ namespace Google.ProtocolBuffers.ProtoGen writer.WriteLine("}");
writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
- writer.WriteLine(" if (result.Has{0} &&", PropertyName);
+ writer.WriteLine(" if (result.has{0} &&", PropertyName);
writer.WriteLine(" result.{0}_ != {1}) {{", Name, DefaultValue);
writer.WriteLine(" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();", Name,
TypeName);
@@ -112,7 +112,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateParsingCode(TextGenerator writer)
{
writer.WriteLine("{0}.Builder subBuilder = {0}.CreateBuilder();", TypeName);
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (result.has{0}) {{", PropertyName);
writer.WriteLine(" subBuilder.MergeFrom({0});", PropertyName);
writer.WriteLine("}");
if (Descriptor.FieldType == FieldType.Group)
@@ -128,14 +128,14 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateSerializationCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" output.Write{0}({1}, \"{3}\", {2});", MessageOrGroup, Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}
public void GenerateSerializedSizeCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});",
MessageOrGroup, Number, PropertyName);
writer.WriteLine("}");
diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs index 2e767b91..7fc583c3 100644 --- a/src/ProtoGen/PrimitiveFieldGenerator.cs +++ b/src/ProtoGen/PrimitiveFieldGenerator.cs @@ -62,7 +62,7 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateBuilderMembers(TextGenerator writer)
{
writer.WriteLine("public bool Has{0} {{", PropertyName);
- writer.WriteLine(" get {{ return result.Has{0}; }}", PropertyName);
+ writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName);
writer.WriteLine("}");
AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
@@ -102,14 +102,14 @@ namespace Google.ProtocolBuffers.ProtoGen public void GenerateSerializationCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" output.Write{0}({1}, \"{3}\", {2});", CapitalizedTypeName, Number, PropertyName, Descriptor.Name);
writer.WriteLine("}");
}
public void GenerateSerializedSizeCode(TextGenerator writer)
{
- writer.WriteLine("if (Has{0}) {{", PropertyName);
+ writer.WriteLine("if (has{0}) {{", PropertyName);
writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});",
CapitalizedTypeName, Number, PropertyName);
writer.WriteLine("}");
|