From c6dae657fbd1c7fa8331983a740dabe7b4eacc00 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 16 Mar 2022 12:44:08 -0700 Subject: [PATCH] Reserve elements from vector before calling push_back(). --- upbc/protoc-gen-upb.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index 2ced805c4c..d3291a3cd4 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -108,6 +108,7 @@ void AddEnums(const protobuf::Descriptor* message, std::vector SortedEnums( const protobuf::FileDescriptor* file) { std::vector enums; + enums.reserve(file->enum_type_count()); for (int i = 0; i < file->enum_type_count(); i++) { enums.push_back(file->enum_type(i)); }