Skip to content

Replace superfluous Default member with default values #1693

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 1 commit into from
Feb 9, 2022

Conversation

andyleejordan
Copy link
Member

I think this was a case of premature optimization. We're using C#
records, which should be as cheap as an object as they come, especially
when we can rely on the compiler for default values. Now we're passing
fewer objects around too.

@andyleejordan andyleejordan added the Ignore Exclude from the changelog. label Feb 1, 2022
@andyleejordan
Copy link
Member Author

No clue why that CI failed, everything passes locally. Rerunning.

@SeeminglyScience
Copy link
Collaborator

We're using C# records, which should be as cheap as an object as they come

You just mean that there isn't likely to be a lot of initialization involved right? Just clarifying because a record is just sugar for a class with some extra methods and an interface defined. It's still extra heap allocations.

That said, it's just some extra heap allocations that are unlikely to even be measurable so if you prefer it I don't feel strongly either way.

@andyleejordan andyleejordan force-pushed the andschwa/remove-default-member branch from 2f1426d to 5005c0f Compare February 1, 2022 23:50
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM (assuming the CI failures is sorted)

@andyleejordan
Copy link
Member Author

Damn, I want to know what's up with the CI...it doesn't fail locally 😅

@andyleejordan andyleejordan force-pushed the andschwa/remove-default-member branch 3 times, most recently from 96ab79f to 2001001 Compare February 9, 2022 00:29
@andyleejordan
Copy link
Member Author

@SeeminglyScience Tracked down the source of the failure and it was because we actually needed to do the null coalescing in the SynchronousTask constructors.

I think this was a case of premature optimization. We're using C#
records, which should be as cheap as an object as they come, especially
when we can rely on the compiler for default values. Now we're passing
fewer objects around too.
@andyleejordan andyleejordan force-pushed the andschwa/remove-default-member branch from 2001001 to d7ca65e Compare February 9, 2022 00:42
@andyleejordan andyleejordan enabled auto-merge (squash) February 9, 2022 00:45
@andyleejordan andyleejordan merged commit 77d1ffc into master Feb 9, 2022
@andyleejordan andyleejordan deleted the andschwa/remove-default-member branch February 9, 2022 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ignore Exclude from the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants