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

Add benchmark for source-generated SetBinding #25

Merged

Conversation

simonrozsival
Copy link
Owner

@simonrozsival simonrozsival commented Apr 22, 2024

Method Mean Error StdDev Gen0 Gen1 Allocated
TypedBindName 13.11 us 0.244 us 0.251 us 1.2207 0.6104 7.5 KB
SourceGeneratedBindName 14.39 us 0.137 us 0.129 us 1.3580 0.6714 8.36 KB
BindName 16.98 us 0.315 us 0.279 us 1.6785 0.8240 10.31 KB
TypedBindChild 20.47 us 0.214 us 0.190 us 2.0142 1.0071 12.42 KB
SourceGeneratedBindChild 21.09 us 0.374 us 0.349 us 2.1667 1.0681 13.28 KB
BindChild 21.51 us 0.284 us 0.266 us 2.5940 1.2817 16.02 KB
TypedBindChildIndexer 21.78 us 0.361 us 0.338 us 2.3193 1.1597 14.38 KB
SourceGeneratedBindChildIndexer 22.46 us 0.264 us 0.247 us 2.4719 1.2207 15.23 KB
BindChildIndexer 41.00 us 0.459 us 0.429 us 4.1504 2.0752 25.55 KB

Copy link

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

Copy link

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@@ -56,7 +56,7 @@ public static DiagnosticInfo SuboptimalSetBindingOverload(Location location)
title: "SetBinding with string path",
messageFormat: "TODO: consider using SetBinding overload with a lambda getter",
category: "Usage",
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true),
defaultSeverity: DiagnosticSeverity.Hidden,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep some ""diagnostic"" even if we do not show it to the user. Currently it will be reported as hidden, we can introduce an explicit list of diagnostic we do not report and filter out before reporting ,if this is not enough.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this still be shown in the CLI output or in VS/VSCode?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running the sample app with different overload, did not see any warnings/errors. When passing func it shows correct error.

{
return new EquatableArray<DiagnosticInfo>([DiagnosticsFactory.SuboptimalSetBindingOverload(invocation.GetLocation())]);
}
var secondArgument = argumentList[1].Expression;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we do the validation of the number of arguments in IsSetBindingMethod but it's still making me a little uneasy to just reach for an index without a check for the length of the array in the same scope. This could break if somebody refactors this code later. I'd just add ArgumentOutOfRangeException.ThrowIfLessThan(argumentList, 2);

Copy link

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@simonrozsival simonrozsival merged commit c514c27 into binding-source-generator Apr 23, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants