Fix unnecessary string copies in verify tests - #622
Open
stefanatwork wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses Coverity COPY_INSTEAD_OF_MOVE findings in the verify tutorial tests by making string construction/forwarding move-aware, reducing unnecessary std::string copies in test constructors.
Changes:
- Add
<utility>to supportstd::movein the verify test header. - Move
std::stringconstructor parameters into stored members (e.g.,Test::name) instead of copying. - Forward
std::stringparameters viastd::movefrom derived test constructors into baseTest/IntersectTestconstructors (and similarly move other string parameters likemodel/tri_accel).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tutorials/verify/verify.h | Uses std::move to construct/store test names without extra copies; adds <utility>. |
| tutorials/verify/verify.cpp | Updates many verify test constructors to move-forward std::string parameters into base classes / members. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
stefanatwork
force-pushed
the
fix/coverity-string-moves
branch
from
August 19, 2026 15:29
108af5f to
f8ae7a7
Compare
Found via clang-tidy (performance-unnecessary-value-param, performance-move-const-arg, modernize-pass-by-value): - Pass Benchmark's name/unit by value and move into members instead of copying, and forward name via std::move in SimpleBenchmark, ParallelIntersectBenchmark and CreateGeometryBenchmark. - Move name into TestGroup's base Test constructor instead of copying. - Change parameters that are only read (never moved) to const references: TestGroup::add, TestGroup::extend_prefix, prefix_test_names, enable_disable_all_tests, enable_disable_some_tests's test param, plot's outFileName/xlabel, regex_match, and command-line option lambdas that don't consume cin. - Forward cin via std::move where it is passed on by value exactly once (plot-over-primitives/plot-over-threads). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apply move-aware string forwarding in verify test constructors
Resolve Coverity COPY_INSTEAD_OF_MOVE findings