Skip to content

reportProgress: take the callback by const reference - #7145

Merged
Fedr merged 1 commit into
masterfrom
report-progress-const-ref
Oct 15, 2026
Merged

Fedr merged 1 commit into
masterfrom
report-progress-const-ref

Conversation

@Fedr

@Fedr Fedr commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

All four reportProgress overloads took ProgressCallback by value, so every call copied the std::function. That copy allocates whenever the callable does not fit the small buffer, and reportProgress is called in hot loops and, since #7143, under ParallelProgressReporter's mutex.

They now take const ProgressCallback&, matching splitProgress. Overload resolution and call sites are unchanged: lambdas and {} still bind to the temporary. subprogress keeps taking the callback by value, since it moves it into the returned lambda.

Checked locally: MRMesh builds with MSVC, no warnings.

🤖 Generated with Claude Code

Passing ProgressCallback by value copied the std::function on every call,
which allocates when the callable does not fit the small buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fedr
Fedr merged commit d97acdd into master Oct 15, 2026
59 checks passed
@Fedr
Fedr deleted the report-progress-const-ref branch October 15, 2026 09:58
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