Several performance tweaks
- Removed default value assingment when default is equal to default(T)
- Added Benchmarks for most types and repeated/packed arrays
- Left PopsicleList's list fields uninitialized util needed
- Changed CodedInputStream's repated/packed reader
- Changed Enum writers to simply cast to int
- Changed the WriteEnum to use object rawValue that provides .ToString() if needed
- Should be fully on par with original library for performance, gaining 2x-3x in some cases
diff --git a/src/AddressBook/AddressBookProtos.cs b/src/AddressBook/AddressBookProtos.cs
index 58cba4a..dcaad48 100644
--- a/src/AddressBook/AddressBookProtos.cs
+++ b/src/AddressBook/AddressBookProtos.cs
@@ -163,7 +163,7 @@
output.WriteString(1, field_names[0], Number);
}
if (hasType) {
- output.WriteEnum(2, field_names[1], (int) Type, Type.ToString());
+ output.WriteEnum(2, field_names[1], (int) Type, Type);
}
UnknownFields.WriteTo(output);
}
@@ -407,7 +407,7 @@
public const int IdFieldNumber = 2;
private bool hasId;
- private int id_ = 0;
+ private int id_;
public bool HasId {
get { return hasId; }
}