Skip to content
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

Glob.Match takes enum as in argument #4

Open
idg10 opened this issue Oct 11, 2021 · 1 comment
Open

Glob.Match takes enum as in argument #4

idg10 opened this issue Oct 11, 2021 · 1 comment

Comments

@idg10
Copy link
Contributor

idg10 commented Oct 11, 2021

The System.StringComparison type is an enum, which uses the default int underlying storage type.

The Glob.Match method includes an in StringComparison parameter. I would expect that at best this will offer no benefit and at worst it will add unnecessary extra overhead. With some value types, use of in reduces the amount of work required to invoke a method, but generally that only works if the value type in question is larger than a pointer. In this case, it's either the same size as a pointer, or, in a 64-bit process, it's actually half the size of a pointer, so there's no obvious benefit to passing by read-only reference (in) here.

So unless something odd is going on in the JIT, this seems likely either to have no effect or to make things worse.

@mwadams
Copy link
Contributor

mwadams commented Oct 11, 2021

I will validate this with benchmarking, but I have a vague memory that it did make a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants