Skip to content

Add skipautoprops feature #912

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

Conversation

MarcoRossignoli
Copy link
Collaborator

@MarcoRossignoli MarcoRossignoli commented Jul 26, 2020

closes #328
High pri feat as planned https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/Roadmap.md#high-priority

I did also manual tests on my local with all three drivers

cc: @tonerdo @petli

@MarcoRossignoli MarcoRossignoli added the feature-request New feature request label Jul 26, 2020
@MarcoRossignoli MarcoRossignoli requested review from tonerdo and petli July 26, 2020 13:34
tonerdo
tonerdo previously requested changes Aug 3, 2020
Copy link
Collaborator

@tonerdo tonerdo left a comment

Choose a reason for hiding this comment

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

Implementation seems fine modulo the comments on explicit backing fields

get { return _output; }
set { _output = value; }
}
public string Output { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

One reason I use explicit backing fields is to prevent the overhead of frequent method calls. It's probably bad for performance

Copy link
Collaborator Author

@MarcoRossignoli MarcoRossignoli Aug 3, 2020

Choose a reason for hiding this comment

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

I think that autoprops are inlined by jitter, take a look here https://sharplab.io/#v2:C4LghgzgtgPgAgJgIwFgBQcDMACR2DC2A3utmbjvgBQCUp5Ja5z2ACgE4D2ADhNgLzYkABgDc9MgF8JFbAEsAdsDZdexAOYBTYKIjbR0tIfTosuBNgCy6Rsxlm4AFmwAVTRGC0ZtlmUIBjAWwFTQB3AlpxJl9cJABOKn8AOg4eCBoo5kk7I3QgA=

image

Also I agree in case of hot loops, but here this properties are accessed only one time on msbuild task usage.
What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jkotas, sorry to bother you, can you confirm that autoprops are inlined by jitter?

Copy link
Collaborator

@tonerdo tonerdo Aug 3, 2020

Choose a reason for hiding this comment

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

I was referring more to the general case because we're targeting .NET standard. Inlining of auto props is an implementation detail of the JIT, at least I don't recall it being in the CLI spec. Do we have any plans to support other runtimes beyond .NET Core?

Copy link
Collaborator Author

@MarcoRossignoli MarcoRossignoli Aug 3, 2020

Choose a reason for hiding this comment

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

Do we have any plans to support other runtimes beyond .NET Core?

We support .NET Framework at the moment(not yet on collectors but I'm waiting some answer from vstest team). In this case(inlining apart) I would prefer clean syntax over perf...I mean this code is called only one time for asm, we spend a lot of time on IL instrumentation(I think mangnitude orders), btw I won't oppose if you prefer custom back field, let me know!It was instinctive from my side 😄

Copy link

Choose a reason for hiding this comment

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

Any runtime where performance matters will inline auto-properties just fine. It is certainly the case for both .NET Framework and .NET Core.

If you wanted to optimize for hypothetical runtimes that are missing basic optimizations, your code would look very unnatural. You would want to e.g. prefer public fields over properties, minimize number of methods and making methods as big as possible, etc. It does not sounds like a good idea.

@tonerdo tonerdo dismissed their stale review August 3, 2020 12:28

Didn't realize requesting changes actually blocks merging. They were mostly just comments to take note of

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

Successfully merging this pull request may close these issues.

Option to ignore field/property initializers and auto-implemented properties
3 participants