"Wasteful virtuals" "virtuals with no overrides" has false positives with multiple levels of inheritance
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing the "wasteful virtuals" heuristic, especially the "virtuals with no overrides" list, using the A/B/C inheritance example in the issue. Reproduce the false positive and verify that A::DoStuff is no longer reported when an override exists through an intermediate derived class.
Written by the indexing model from the issue text.
Description
Describe the bug
I was using the "wasteful virtuals" heuristic to try and optimize a large binary. The "virtuals with no overrides" list specifically is easy gains. However, one of the methods flagged does have overrides and removing the virtual keyword introduced a build break.
On closer inspection the problem seems to be that the virtual method and the override has at least one other derived class in the middle.
The heirarchy is roughly as follows:
class A
{
public:
virtual void DoStuff() { }
};
class B : public A
{ };
class C : public B
{
public:
void DoStuff() override { }
};
In this case A::DoStuff is considered a wasteful virtual even though C::DoStuff overrides it. Removing the virtual keyword will introduce a build break.
Expected behavior
This method should not be considered wasteful.
Screenshots
N/A
Environment Details
OS is Windows 11.
SizeBench is latest version from the Store at this time (on a different device so I don't have the exact version handy).
Additional context
N/A
- Dominant language
- C#
- Stars
- 175
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/SizeBench
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Hang Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in microsoft/SizeBench
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·