diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-05 09:33:44 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-07 14:43:19 +0200 |
commit | c1edc2e21ecf381470d71767dc38a83c85f57d23 (patch) | |
tree | cf14c408ee080df389c9f79d3be95eb253285839 /src/buildtool/execution_api/execution_service/execution_server.cpp | |
parent | 7012f6c0762cf11e7b1c22304f8fb0b3b330cd0a (diff) | |
download | justbuild-c1edc2e21ecf381470d71767dc38a83c85f57d23.tar.gz |
Avoid deep copies of containers in responses.
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 132a812f..c99cfa04 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -281,15 +281,16 @@ static auto CreateTreeDigestFromDirectoryDigest( static auto AddOutputPaths(::bazel_re::ExecuteResponse* response, IExecutionResponse::Ptr const& execution, Storage const& storage) noexcept -> bool { - auto const& artifacts_plus = execution->ArtifactsWithDirSymlinks(); - auto const& size = static_cast<int>(artifacts_plus.first.size()); + auto const& artifacts = execution->Artifacts(); + auto const& dir_symlinks = execution->DirectorySymlinks(); + auto const size = static_cast<int>(artifacts.size()); response->mutable_result()->mutable_output_files()->Reserve(size); response->mutable_result()->mutable_output_file_symlinks()->Reserve(size); response->mutable_result()->mutable_output_directory_symlinks()->Reserve( size); response->mutable_result()->mutable_output_directories()->Reserve(size); - for (auto const& [path, info] : artifacts_plus.first) { + for (auto const& [path, info] : artifacts) { auto dgst = static_cast<::bazel_re::Digest>(info.digest); if (info.type == ObjectType::Tree) { @@ -326,7 +327,7 @@ static auto AddOutputPaths(::bazel_re::ExecuteResponse* response, return false; } *(out_link.mutable_target()) = *content; - if (artifacts_plus.second.contains(path)) { + if (dir_symlinks.contains(path)) { // directory symlink response->mutable_result() ->mutable_output_directory_symlinks() |