Skip to content

refs #14593 - improved string concatenation in ScopeInfo3 constructor#8334

Merged
firewave merged 1 commit into
cppcheck-opensource:mainfrom
firewave:simplifyusing-x
Mar 16, 2026
Merged

refs #14593 - improved string concatenation in ScopeInfo3 constructor#8334
firewave merged 1 commit into
cppcheck-opensource:mainfrom
firewave:simplifyusing-x

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud

Copy link
Copy Markdown

@firewave

Copy link
Copy Markdown
Collaborator Author

Analyzing https://github.com/WinterSnowfall/d7vk/blob/1b4d4f0d87e1c04061a6899e03d4f0e426e2d545/src/ddraw/d3d3/d3d3_device.cpp with -D_MSC_VER.

Clang 21 - 3,349,539,134 -> 3.329,173,343
GCC 15 - 3,322,719,077 -> 3,300,326,424

Would be good to have a check to detect such code.

@firewave

Copy link
Copy Markdown
Collaborator Author

Callgrind in CI: 54,573,693,766 -> 54,544,753,190

@chrchr-github chrchr-github changed the title refs #14593 - improved string concatination in ScopeInfo3 constructor refs #14593 - improved string concatenation in ScopeInfo3 constructor Mar 13, 2026
@chrchr-github

chrchr-github commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator

Would be good to have a check to detect such code.

Related: https://trac.cppcheck.net/ticket/12857

@firewave

Copy link
Copy Markdown
Collaborator Author

Would be good to have a check to detect such code.

Related: https://trac.cppcheck.net/ticket/12857

Added https://trac.cppcheck.net/ticket/12857#comment:10. Will file an upstream ticket later.

@danmar danmar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the code is uglier and less readable :-(
speed is really important so I approve this.
but I am wondering if there is some alternative to tweak the code in release builds instead.
something like the matchCompiler but with type information would be needed.

@firewave

Copy link
Copy Markdown
Collaborator Author

Matchcompiling would be undesired as we would lose the improvements in regular (and non-release) builds (which is why I tried to separate out some cases in the past).

I do not like the decreased readability either so I thought about adding a helper instead. I will propose that in a separate PR as I am not sure about the parameters yet and I am also very bad an varargs.

@firewave firewave merged commit 1d1f747 into cppcheck-opensource:main Mar 16, 2026
72 checks passed
@firewave firewave deleted the simplifyusing-x branch March 16, 2026 13:45
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.

3 participants