Instead, keep the notion of use-path-trees in the lowered AST. This prevents the name resolver from having to resolve the common path prefixes over and over again as it can simply store the resolved relative root.
Consider (not everything shown):
use alpha.beta.gamma.(delta epsilon zeta eta)
which is a very common pattern (in Rust at least).
Today, this looks like the following for the name resolver:
use alpha.beta.gamma.delta
use alpha.beta.gamma.epsilon
use alpha.beta.gamma.zeta
use alpha.beta.gamma.eta
It has to resolve alpha.beta.gamma 4 times (!) having to
potentially resolve very deep alias chains
potentially resolve out-of-order bindings filling up the work list (addendum: maybe that work is done once even today, not sure)
Instead, keep the notion of use-path-trees in the lowered AST. This prevents the name resolver from having to resolve the common path prefixes over and over again as it can simply store the resolved relative root.
Consider (not everything shown):
which is a very common pattern (in Rust at least).
Today, this looks like the following for the name resolver:
It has to resolve
alpha.beta.gamma
4 times (!) having to