Description
Is your feature request related to a use case or problem? Please explain
#6882 created a cache that sped up circuit construction if only "append" (or equivalent "insert" at end w/ EARLIEST strategy) was used. If other types of "insert", "delete", or any other circuit mutation was used (see instances of _placement_cache = None
), the cache was simply deleted and subsequent mutations (including appends) fell back to the old "check every moment" algorithm.
Describe the solution you would prefer
There are probably some clever algorithms or data structures that could maintain the placement cache through more types of mutations. Or another option could be if the placement cache was deleted and subsequently the user calls a few "appends" in a row, to assume there are more coming and have some code that regenerates the placement cache a-priori. (It'd be nice to see some real-world use cases of large circuits that use mutations other than "append", to make sure any solution is optimizing the right thing).
How urgent is this for you? Is it blocking important work?
P3 – I'm not really blocked by it; it's an idea I'm proposing based on principle