Skip to content

Look up code references within libraries by map rather than traversing a list #1829

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 3 commits into from
Nov 13, 2018

Conversation

jcollins-g
Copy link
Contributor

@jcollins-g jcollins-g commented Nov 12, 2018

Fairly low hanging fruit to improve generator performance, but more risky than #1828. Especially good on heavily code-referenced codebases like Flutter's, around 20% runtime reduction in the generator stage.

Checked with compare-flutter-warnings to make sure it didn't impact generation for Flutter.

Also extracts a few functions to make looking around in the profiler easier.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Nov 12, 2018
_getResultsForClass(
tryClass, codeRefChomped, results, codeRef, packageGraph);
}
results.remove(null);
Copy link
Member

Choose a reason for hiding this comment

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

What does removing null here do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing all that useful most of the time. Some of the blocks are capable of adding nulls to the results set, but instead of trying to determine exactly which ones could possibly add a null sometimes we just stamp it out every time.

The refactor left these remove(null) calls in some of the functions. Reorganized this dance to be a little more consistent and added a TODO to get rid of it.

}
}
}
results.remove(null);
Copy link
Member

Choose a reason for hiding this comment

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

... And why again here and in the super chain loop above?

Copy link
Contributor Author

@jcollins-g jcollins-g Nov 13, 2018

Choose a reason for hiding this comment

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

Necessary inside the loop because we're again using "set is empty" as a proxy for no results, and sometimes null gets added instead of a result.

@pq
Copy link
Member

pq commented Nov 13, 2018

Thanks for clarifying!

@jcollins-g jcollins-g merged commit c8134e5 into master Nov 13, 2018
@jcollins-g jcollins-g deleted the drop-library-traversal branch November 13, 2018 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants