Skip to content

Conversation

@SunnyWar
Copy link
Contributor

@SunnyWar SunnyWar commented Sep 6, 2025

…> includes

- Pass expensive-to-copy parameters as const references where possible
- Apply std::move to transfer ownership in constructors and factory registrations
- Update lambdas to take const refs for non-modified parameters
- Include <utility> in affected files to support std::move
@mooskagh
Copy link
Member

mooskagh commented Sep 7, 2025

Note that most of our usages of std::string would actually be better to replace with std::string_view. That's something that I wanted to do but didn't have time.

I'll take a closer look next week, unless somebody else beats me to it.

@mooskagh mooskagh requested a review from Copilot September 7, 2025 21:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the codebase to improve performance by using const references and std::move for expensive-to-copy parameters, following clang-tidy performance recommendations.

  • Pass string parameters as const references to avoid unnecessary copies
  • Apply std::move for ownership transfer in constructors and factory registrations
  • Add <utility> includes where std::move is used

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/trainingdata/writer.cc Add utility include and use std::move in constructor
src/trainingdata/reader.cc Add utility include and use std::move in constructor
src/tools/backendbench.cc Convert function parameters to const references
src/search/classic/search.cc Add utility include, update lambda and function parameters
src/search/classic/params.cc Convert function parameters to const references
src/neural/wrapper.cc Add utility include, update function parameters and constructor
src/neural/onnx/converter.cc Convert function parameters to const references
src/neural/onnx/adapters.cc Convert template function parameter to const reference
src/neural/factory.cc Add utility include and use std::move in factory registration
src/neural/backends/network_mux.cc Convert shared_ptr parameter to const reference

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants