microsoft / microsoft/SizeBench

SizeBench Duplicate Data suggestions should vary with project language

Open
#15 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
175
Forks
20
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the duplicate data feature where the two reported suggestion messages are generated, and trace how project language information is available. Check the advice against the C++ case described in the issue and determine how other languages should be handled. Done means the guidance no longer presents misleading recommendations for C++ projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.