4 ms·
Funny coincidence, I'm tweaking performance of manually managed contiguous memory using structs and refs as I'm writing this reply (the application is a combina
by Anchor 10y ago
Funny coincidence, I'm tweaking performance of manually managed contiguous memory using structs and refs as I'm writing this reply (the application is a combinatorial optimization system). There's nothing in ReSharper that currently suggests me to replace structs and refs with something else, or that I need indirections into my SoAs and AoSs.
But yeah, static analysis can yield false positives if you use for example reflection (one more reason to avoid it in most cases), but there's an option to turn a specific message off for particular line, class, etc. You can also edit ReSharper suggestions per solution basis, so if there are some special requirements, they can be incorporated into its behavior.
- jeremiep 10y agoIt probably improved a lot since the last time I used it. I haven't done any C# in a while :) It wasn't complaining about structs or refs but wanted LINQ everywhere, anonymous lambdas and other high level constructs in place of high-performing but harder to read ones. I wasn't using reflection either, it was something like this simplified pseudocode (off the top of my head, I haven't touched that codebase in over a year): var completed = false for each line in timeline do completed = completed || tick(line) if completed // here it complained its always false There was more to it (to handle time offsets and multipliers, disabled lines and whatnot) but thats the gist of the algorithm. After disabling or tweaking rules every day I just decided to uninstall it, and as I said its a wonderful tool - just not for that specific task at that specific point in time :)
- BoorishBears 10y agoI still say Resharper taught me Linq back when it first came out. It'd generate some abhorrent Linq statements in place of very clean, readable code, but just trying to grok what those statements meant made me so much more comfortable with it. And of course I'd always go back and undo the changes, but occasionally it'd do something that was the right balance of nifty and readable that I'd try to salvage out of the larger statement and reuse elsewhere. It's true it takes some effort to tweak it to cut down on noise from its analysis (and IntelliJ has the same issue), but I think it manages to be worth it over all (assuming you have that time and effort to contribute, which it sounds like you didn't at the time)
- Anchor 10y agoThe pseudocode is intriguing. I personally have been stumped 2 or 3 times by static code analysis, disagreeing firmly with the machine for few minutes before realizing my mistake, but it is of course possible that there have been bugs in the analysis system of R#, which might explain what you saw. Adjusting the rules and settings of R# is a daunting task, I agree. However, usually if I have special requirements for a project, I just set Inspection Severity to none for the language features I don't want to use, and that solves the issue for that project.