From 2a6fc53272f9f8df11936634d04095b3f9f9e5ca Mon Sep 17 00:00:00 2001 From: Shahzad Lone Date: Wed, 16 Jan 2019 11:32:48 -0500 Subject: [PATCH] [Minor Performance Improvement] - Reserve vector, to save reallocation costs. File: [xdl/core/backend/mxnet/convert_utils.cc] Function: [164:MX2XDL::ConvertShape] Reserving vector where we already know the size to save on reallocation costs. --- xdl/xdl/core/backend/mxnet/convert_utils.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/xdl/xdl/core/backend/mxnet/convert_utils.cc b/xdl/xdl/core/backend/mxnet/convert_utils.cc index 8aabe708..ed079117 100644 --- a/xdl/xdl/core/backend/mxnet/convert_utils.cc +++ b/xdl/xdl/core/backend/mxnet/convert_utils.cc @@ -163,6 +163,7 @@ Status MX2XDL::ConvertType(const int s, xdl::DataType* d) { Status MX2XDL::ConvertShape(const std::vector& s, xdl::TensorShape* d) { std::vector dims; + dims.reserve(s.size()); for (auto dim: s) { dims.push_back(static_cast(dim)); }