Use singleton SwapGate in Sabre reconstruction#10865
Conversation
|
One or more of the the following people are requested to review this:
|
|
With #10314 merged, both |
|
In my local testing the overhead of calling with #10314. This is actually a significant regression because before #10314 it took ~666ns: so doing this can save a noticeable amount of time depending on how many swaps we need to create. |
mtreinish
left a comment
There was a problem hiding this comment.
This LGTM, it's a straightforward optimization. We should look at the runtime overhead of SingletonGate.__new__ in parallel to try and minimize the overhead there.
|
Fwiw, there's a bunch of "hidden" overhead of
One potential way around this is to have the singleton class be a metaclass that overrides |
Since `SwapGate` is now a singleton instance in most cases, we can directly reuse the same instance during Sabre reconstruction rather than wasting cycles re-retrieving the singleton instance.
6270720 to
32a8842
Compare
|
Now rebased over #10782. |
Pull Request Test Coverage Report for Build 6250595529
💛 - Coveralls |
Summary
Since
SwapGateis now a singleton instance in most cases, we can directly reuse the same instance during Sabre reconstruction rather than wasting cycles re-retrieving the singleton instance.Details and comments
See #10314 for the root of this.