Skip to content

SizeBench Duplicate Data suggestions should vary with project language #15

@rosalesi

Description

@rosalesi

Describe the bug
SizeBench duplicate data advice is inaccurate. Inside the duplicate data feature, SizeBench says that "Changing to const 'constexpr' or 'const' or 'extern __declspec(selectany) const' will save copies.". This is only partially true depending on which language the user's project is written in. In Chromium's case, it is written in C++ where both const and constexpr symbols defined inside classes are implied to be static. The only part of the suggestion which works in Chromium's case is '__declspec(selectany) const'.

Expected behavior
SizeBench should give advice based on which language the user's project is written in. At the very least, it should have a warning that the current suggestions aren't for C++. This would prevent users from potentially losing development time on C++ projects.

Screenshots
SizeBench suggestion after opening duplicate data feature
Text:
These chunks of data are marked as 'static const' or in some cases just 'const' and have ended up with multiple copies of their data in the binary. Typically you'll see one copy per translation unit referencing the symbol. Changing to 'extern __declspec(selectany) const' will save copies.
image

SizeBench suggestion after opening a symbol in duplicate data feature
Text:
This symbol is duplicated between multiple compilands - the most common cause of this is that it is marked 'static const' and would be better off marked as 'const' or 'extern __declspec(selectany) const'. With the way it is defined now, it is wasting space in the binary with the same data in multiple locations.
image

Environment Details

  • OS: Microsoft Windows [Version 10.0.19044.2130]
  • SizeBench version number: 1.0.0.0

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions