Description
places_conflict
currently accounts for 8% of MIR borrowck time. Most of that time, based on perf annotate
results, seems to be spent in and around the SmallVec
operations (e.g., push
and into_iter
). The tricky part here is that the Place
data structures we are using are setup as a kind of tree, so that x.a.b
is sort of like this:
- Projection of
b
from:- Projection of
a
from:- Local variable
x
- Local variable
- Projection of
But we want to iterate "bottom up", so x
, then a
, then b
. This doesn't lend itself to a simple iterator so we currently build up a SmallVec
of results.
It might be a win instead to build up a (stack-allocated) linked list by recursively "unrolling" the paths for both sides. Or perhaps dong other experiments, such as sharing a Vec
buffer (that seemed a bit tricky from a type perspective when I looked into it).
Longer term, I'd like to move away from using Place
here (and perhaps change how Place
is setup in MIR) but it seems worth trying to tackle this in a targeted way.