aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/proto_text
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-06-01 09:42:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-01 09:45:21 -0700
commiteb10a4c494d95e7c17ddc44ef35197d08f2f6b33 (patch)
treec920e61142ba74b437c3c39036a4748ba575b039 /tensorflow/tools/proto_text
parentce32228c49e595f966485acee947131e4ab04905 (diff)
Preallocate vector storage when the ultimate vector size is known in advance
PiperOrigin-RevId: 157724431
Diffstat (limited to 'tensorflow/tools/proto_text')
-rw-r--r--tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc b/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
index 1586e1ba41..62e29b5128 100644
--- a/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
+++ b/tensorflow/tools/proto_text/gen_proto_text_functions_lib.cc
@@ -634,6 +634,7 @@ void Generator::AppendDebugStringFunctions(const Descriptor& md) {
Print().Print("namespace internal {").Print();
Print(sig, " {").Nest();
std::vector<const FieldDescriptor*> fields;
+ fields.reserve(md.field_count());
for (int i = 0; i < md.field_count(); ++i) {
fields.push_back(md.field(i));
}