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

Circular dependency checker can be slow #65

Open
vbraun opened this issue Jan 15, 2021 · 1 comment · May be fixed by #66
Open

Circular dependency checker can be slow #65

vbraun opened this issue Jan 15, 2021 · 1 comment · May be fixed by #66

Comments

@vbraun
Copy link

vbraun commented Jan 15, 2021

Angular runs circular-dependency-plugin on each incremental build, so speed is somewhat important

On a largeish hybrid app with complicate imports (in particular, the angularjs part doesn't use modules / barrel files, so the import graph is pretty complicated) a no-change incremental build is about 8s with and 3s without circular dependency checking on a state of the art desktop.

Initially reported at angular/angular-cli#19794

There is a PR languishing at #49, but Tarjan's algorithm is also suboptimal for detecting whether there is a cycle (however it is a good algorithm for enumerating all cycles).

See also: https://stackoverflow.com/questions/261573/best-algorithm-for-detecting-cycles-in-a-directed-graph

@vbraun vbraun linked a pull request Jan 15, 2021 that will close this issue
@hedgepigdaniel
Copy link
Contributor

Tarjan's algorithm is also suboptimal for detecting whether there is a cycle (however it is a good algorithm for enumerating all cycles).

It's linear in the number of modules + dependencies. Can you do better than that to find if a cycle exists?

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

Successfully merging a pull request may close this issue.

2 participants