Closed
Description
The current implementation walks all the source files to parse the module header and then proceeds to locate the imports. In large repos (>10000 modules) this results in very long startup times:
- It is sequential
- It is not cached
- UPDATE: It's quadratic
The obvious solution is to cache it so that the cost is only paid once.
Open questions:
- How would we cache it in a way that doesn't become stale?
- Can we reuse one of the existing caches (.hi files, .hie files and hiedb)?
UPDATE: the reason it's quadratic is that we traverse the module graph once from each node, which is O(N^2). I wonder if there's a reason for this, in that Shake would crash if there were cyclic module dependencies and the error reporting would be crappy. /cc @cocreature @ndmitchell any insights?
/cc @wz1000 @mpickering