-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Process wires overriding #1010
Process wires overriding #1010
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #1010 +/- ##
=======================================
Coverage 97.89% 97.89%
=======================================
Files 151 151
Lines 11074 11076 +2
=======================================
+ Hits 10841 10843 +2
Misses 233 233
Continue to review full report at Codecov.
|
Codecov is being mean again lol |
==> GitHub Actions detected.
-> Issue detecting commit SHA. Please run actions/checkout with fetch-depth > 1 or set to 0 🤔 So it looks like codecov is using the wrong commit to generate the |
Is this something we can fix? |
You could try editing the with:
fetch-depth: 0 I'm not sure what this does, but the log tells us to do it 😆 Oh there are more details here: https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches |
@@ -76,8 +76,11 @@ class Wires(Sequence): | |||
and hence interpreted as a single wire. | |||
""" | |||
|
|||
def __init__(self, wires): | |||
self._labels = _process(wires) | |||
def __init__(self, wires, _override=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have never seen "private" kwargs...is there a convention about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to discourage users from using it.
subset = [self[i] for i in indices] | ||
return Wires(subset) | ||
subset = tuple(self._labels[i] for i in indices) | ||
return Wires(subset, _override=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome: small, safe changes that lead to speedups :)
def test_equal_to_tuple(self): | ||
assert Wires([1, 2, 3]) == (1, 2, 3) | ||
assert Wires([1, 2, 3]) != (1, 5, 3) | ||
assert (1, 5, 3) != Wires([1, 2, 3]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also nice!
Context:
Increase speed of wire subset method.
Description of the Change:
Previously, the operation
Wires.subset
was around 20% of the total tape construction time. That has been cut down to just 9% by bypassing the_process
method.Benchmarks from my laptop.
Benefits:
Wire construction is faster
Possible Drawbacks:
None
Related GitHub Issues:
#967