Closed nalka0 closed 3 weeks ago
Hi @nalka0! Thanks a lot for providing the detailed benchmark. We already have an investigation sprint in our backlog to re-run all the benchmarks and compare them, particularly with the .NET 9 implementations. Based on the outcomes, we will decide whether to refactor the rules or deprecate them. We'll keep you updated on our progress once that sprint will start.
Thanks,
Hey there! Thanks for running the benchmarks. I also re-run them, and it seems like I found slightly different results than you. The performance seems to still be better, just not as much as before. This is because of Profile Guided Optimization (PGO), which allows the runtime to optimize more code in .NET 9.
The idea of the rule is sound, and sealed
classes will always be at least as fast, and in complex cases faster than non-sealed ones.
So we will opt to keep the rule as-is for now.
@gregory-paidis-sonarsource How come you found different results than me? What should I do next time to prevent having different results? Or is it just bound to the hardware I run the benchmark on?
I think it's a combination of hardware and running a more complex callback to public override void DoNothing() { }
, as it is probably being optimized away
If it's about running a more complex callback to public override void DoNothing() { }
, shouldn't the benchmark in the rule's documentation be updated accordingly? https://github.com/SonarSource/sonar-dotnet/blob/2ecf742558692066437bc5b7701d2c62c35d92cc/analyzers/rspec/cs/S3260.html#L129
Hey @nalka0 , sorry for the delay. We are discussing internally on how to proceed with this. The rule is a good idea in general, and we will update the RSPEC accordingly.
Description
After re-running your benchmark for S3260 on .Net 8 and 9, it looks like this rule has become irrelevant :
Repro steps
For reference, here's the benchmark's code (same benchmark than the one in the rule's documentation with extra
[SimpleJob]
for .Net 8 and 9)Expected behavior
The rule is disabled for .Net 8 and 9
Actual behavior
This rule is currently always active
Related information