Skip to content

Optimization: Don't pass not-readonly PackedFieldDescriptor with in specifier #197

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

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

SergeiPavlov
Copy link
Collaborator

@SergeiPavlov SergeiPavlov commented Mar 29, 2024

See explanation at https://devblogs.microsoft.com/premier-developer/the-in-modifier-and-the-readonly-structs-in-c/

you should never pass a non-readonly struct as in parameter
|| Method | Mean | Error | StdDev |
|----------------------- |----------:|----------:|----------:|
|AggregatePassedByValue | 71.24 us | 0.3150 us | 0.2278 us |
| AggregatePassedByIn | 124.02 us | 3.2885 us | 9.6963 us |

And making this struct readonly requires more code rewriting

@SergeiPavlov SergeiPavlov requested a review from botinko March 29, 2024 04:57
@SergeiPavlov SergeiPavlov merged commit b8c5abf into master-servicetitan Mar 29, 2024
2 checks passed
@SergeiPavlov SergeiPavlov deleted the PackedFieldDescriptor branch March 29, 2024 06:15
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

Successfully merging this pull request may close these issues.

2 participants