From bf66b1cc04a0b1e13d53e6c52e44188753b932c4 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 16 Sep 2024 11:36:45 +0200 Subject: Avoid additional memory allocations when working with protobuf's types. Although this change doesn't benefit performance anyhow (protobuf's mutable_*() methods allocate memory lazily), it is better to let protobuf do this on its own. --- test/utils/remote_execution/bazel_action_creator.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'test/utils/remote_execution/bazel_action_creator.hpp') diff --git a/test/utils/remote_execution/bazel_action_creator.hpp b/test/utils/remote_execution/bazel_action_creator.hpp index ad9b3fbc..b7185121 100644 --- a/test/utils/remote_execution/bazel_action_creator.hpp +++ b/test/utils/remote_execution/bazel_action_creator.hpp @@ -76,11 +76,9 @@ blobs.emplace_back(dir_id, dir_data, /*is_exec=*/false); bazel_re::Action action; - action.set_allocated_command_digest( - gsl::owner{new bazel_re::Digest{cmd_id}}); + (*action.mutable_command_digest()) = cmd_id; action.set_do_not_cache(false); - action.set_allocated_input_root_digest( - gsl::owner{new bazel_re::Digest{dir_id}}); + (*action.mutable_input_root_digest()) = dir_id; auto action_data = action.SerializeAsString(); auto action_id = BazelDigestFactory::HashDataAs( -- cgit v1.2.3