Avoid redundant next-solver fulfillment scans - #161348
Conversation
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
|
@nnethercote I avoided some of the redundant fulfillment checks where there was no change in the inference state |
|
I'm not expert enough with the trait solver to evaluate this. (@lcnr or @jdonszelmann might have opinions.) It does look like a fairly complex change without much explanation. Did you write the code yourself? |
I used the stalled goal fast path from #158249 and the try_evaluate_obligations work in #160479 |
|
this seems vaguely appropriate, the core idea "fast path if literally no infer var changed since last run" makes a lot of sense to me. The way it's written right now feels very brittle and I would like to encapsulate this somehow in a way that makes it harder to accidentally forget to check/update something. I considered separately having a shared list of what every goal in the fulfillment context is stalled on, so we dont need to iterate over it if literally nothing in it changed even if unrelated infer vars changed. Why do you not reset this counter when rolling back a snapshot. There's a lot of open design space here, think this is definitely a good direction :> |
|
One option is to store the "state after last fulfillment loop" in the That way you could also track "highest mentioned infer var indices" and "lowest constrained infer var" to ignore any constraints for infer vars which the fulfillment context is not stalled on. Idk if that matters :> |
|
@lcnr Thanks for your review I agree about the brittleness though |
but why? rolling them back should be completely correct, should it not? |
I am still unsure about this part but I think you are right here |
Refs #159933
On the reproducer from that