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 optimized helper for Mark/CheckProcessed #1776

Open
sbomer opened this issue Jan 22, 2021 · 0 comments
Open

Add optimized helper for Mark/CheckProcessed #1776

sbomer opened this issue Jan 22, 2021 · 0 comments
Labels
Milestone

Comments

@sbomer
Copy link
Member

sbomer commented Jan 22, 2021

MarkStep uses logic like this in a few places:

if (reason.Kind == DependencyKind.AlreadyMarked) {
	Debug.Assert (Annotations.IsMarked (member));
} else {
	Annotations.Mark (member, reason);
}
// possibly do extra work
if (CheckProcessed (member))
	return;
// do main work for the member

The AlreadyMarked check is to avoid calling Annotations.Mark twice when a different step marks a member through Annotations, and the CheckProcessed call ensures that most of the work is done only once per marked member. Sometimes there is logic in-between which can get called once for each time the member is marked.

We could avoid the AlreadyMarked check by splitting up the MarkStep.Mark* methods into variants that do/don't call Annotations.Mark, or by moving the check into Annotations.Mark.

In cases where there is no "extra work" done between Mark and CheckProcessed, we could then combine the Mark/CheckProcessed calls (assuming it is ok to remove the CheckProcessed extensibility point for derived classes).
With the extra tracking introduced by #1768, this would avoid an extra hashset lookup in a few cases.

See #1768 (comment)

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

No branches or pull requests

2 participants