New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance by using sealed classes #15110
Comments
This is not possible given that But yeah, it would be nice to follow this best practice in our code base to mark types sealed properly.
@iSazonov why PGO would require this? can you please clarify this statement? Also, can you be more specific how PGO can be used in PowerShell? |
My main concern is that using of InternalsVisibleTo will absolutely block PGO for us. There is still no documentation for PGO. You may want to talk to the authors of PGO. I can only guess that InternalsVisibleTo and sealed both truncate any inheritance/virtualization and as a consequence allow bolder optimizations.
From my understanding it is the main purpose of the PGO to improve startup scenario(s). We could create specific PowerShell PGO profile and distribute it with PowerShell.
|
Also I think we could accelerate other typical scenarios too like runspace/scriptblock creation. |
We could look into: https://github.com/geeknoid/UnsealedAnalyzer
|
It is best practice. .Net Runtime can do more optimizations if a class cannot have derived classes and cannot be used outside. |
It would be good to quantify the improvement, to see whether further optimizations of the type would be fruitful. |
We now have |
@iSazonov Could you please reopen? |
Seal classes in RemotingProtocol2 (#21164) contributes to this issue. |
The motivation of this PR is this comment by @PaulHigin PowerShell#11820 (comment). _Contributes to PowerShell#15110._
Inspired by dotnet/runtime#49944
This can be especially important if we use PGO for optimizing startup scenarios.
The text was updated successfully, but these errors were encountered: