RedundantAssignmentIssue is extremely slow when the control flow graph is complex #476

Open
opened 2015-04-10 07:37:48 -05:00 by corngood · 0 comments
corngood commented 2015-04-10 07:37:48 -05:00 (Migrated from github.com)

This is probably easiest to explain by showing the test I wrote:

github.com/corngood/NRefactory@c35584b934

This test will take an extremely long time to complete, and scales non-linearly with the number of if statements. When walking a complex part of the call-graph which doesn't contain any references to the variable, it ends up doing an exhaustive search in RedundantAssignmentIssue.GatherVisitor.ProcessNode.

My initial thought was to just flag variables without any non-assignment references, but A slight variation on the test:

github.com/corngood/NRefactory@bf5fe2aa27

shows the same behaviour can occur even when a reference exists.

This is probably easiest to explain by showing the test I wrote: https://github.com/corngood/NRefactory/commit/c35584b934fb198a219321b2b54b4f492dd7bd9f This test will take an extremely long time to complete, and scales non-linearly with the number of if statements. When walking a complex part of the call-graph which doesn't contain any references to the variable, it ends up doing an exhaustive search in _RedundantAssignmentIssue.GatherVisitor.ProcessNode_. My initial thought was to just flag variables without any non-assignment references, but A slight variation on the test: https://github.com/corngood/NRefactory/commit/bf5fe2aa2776e2d1f745c1e44b647d5c1d6509ca shows the same behaviour can occur even when a reference exists.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/NRefactory#476
No description provided.