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 cycle detection benchmark ahead of #208 #210

Merged
merged 1 commit into from
Sep 17, 2018

Conversation

dnathe4th
Copy link
Contributor

No description provided.

Copy link

@zmt zmt left a comment

Choose a reason for hiding this comment

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

Thanks!

@abhinav abhinav merged commit 039b1c8 into uber-go:master Sep 17, 2018
abhinav pushed a commit that referenced this pull request Sep 18, 2018
This changes `detectCycles` to prevent wasteful recursion and checking
the same types over-and-over again by tracking parameter visits. If
we have checked the providers for a type for cycles once, we don't need
to check it again.

With the benchmark added in #210, before this change we saw:

    BenchmarkProvideCycleDetection-4             100          18365246 ns/op
    
With this change,

    BenchmarkProvideCycleDetection-4            5000            362497 ns/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants