Skip to content

Commit 852f090

Browse files
mingyueliuhliumingyue
andauthored
use std::move(model_proto) to avoid extra copy (#26372)
Previously, model_proto was passed by name, which triggered a copy constructor call instead of move construction. Using std::move(model_proto) ensures that the object is constructed via move semantics, reducing unnecessary memory allocation and copy overhead. Co-authored-by: liumingyue <[email protected]>
1 parent c6c6d78 commit 852f090

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

onnxruntime/core/session/provider_bridge_ort.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ struct ProviderHostImpl : ProviderHost {
12391239
std::unique_ptr<Model> Model__construct(ONNX_NAMESPACE::ModelProto&& model_proto, const PathString& model_path,
12401240
const IOnnxRuntimeOpSchemaRegistryList* local_registries,
12411241
const logging::Logger& logger) override {
1242-
return std::make_unique<Model>(model_proto, model_path, local_registries, logger);
1242+
return std::make_unique<Model>(std::move(model_proto), model_path, local_registries, logger);
12431243
}
12441244
std::unique_ptr<Model> Model__construct(const std::string& graph_name,
12451245
bool is_onnx_domain_only,

0 commit comments

Comments
 (0)