Replies: 1 comment
-
No, because it's not done by the JIT and out of scope. The work for array is done by C# compiler: https://sharplab.io/#v2:D4AQDABCCMAsDcBYAUCkAmCBBFBvFEhUAzFNGANoC6EAshALwB8BRFrRRARAIYBGAYy4AaDpwhcAHgE8AXiLGcu0dMS5iqSZAF8UaTACE8YkKQASPAM4ALAMoBTAC4AeGGCZ1GLZJ3Y/xhLyCCv4BUnIhAYEqahpaushAA== There is optimal building support for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://godbolt.org/z/eE5svxTMo
class A
benefits from JIT optimizations: the array setup is simplified to a direct allocation and pointer assignments, making it efficient with minimal overhead.In
class B
, usingHashSet<string>
is more costly:AddIfNotPresent
).@EgorBo Could the JIT optimize
HashSet
initialization for known unique values, reducing redundant checks?Beta Was this translation helpful? Give feedback.
All reactions