[nll] optimize places_conflict
... somehow
#51820
Labels
NLL-performant
Working towards the "performance is good" goal
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone
places_conflict
currently accounts for 8% of MIR borrowck time. Most of that time, based onperf annotate
results, seems to be spent in and around theSmallVec
operations (e.g.,push
andinto_iter
). The tricky part here is that thePlace
data structures we are using are setup as a kind of tree, so thatx.a.b
is sort of like this:b
from:a
from:x
But we want to iterate "bottom up", so
x
, thena
, thenb
. This doesn't lend itself to a simple iterator so we currently build up aSmallVec
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 howPlace
is setup in MIR) but it seems worth trying to tackle this in a targeted way.The text was updated successfully, but these errors were encountered: