object88 / langd

A Language Server Protocol implementation in Go for Go
MIT License
7 stars 0 forks source link

Delay package import cycle check #24

Closed object88 closed 6 years ago

object88 commented 6 years ago

When loading a very large project, just checking the package DAG for cycles can take a significant amount of time (seconds). Look for a way to delay that check until the last moment, so that we are not continuously re-checking. This may also reduce mutex lock time on the caravan.

object88 commented 6 years ago

Fixed by another means. We cannot delay the check for loops; that has to happen each time that we insert another element into the DAG, because we immediately block & wait for the children of a node to be ready. If there is a loop at that point, we will get stuck, so we can't wait any longer.

However, the caravan had a bug wherein it was not tracking which nodes were checked as it transversed the DAG, so leaves were being repeatedly checked over and over. Once we started tracking which leaves are already inspected (and therefore, cannot have loops), we eliminated all the performance issues.