quil-rs
quil-rs copied to clipboard
Can `Program.__add__`'s performance be improved?
This is the current implementation of __add__ for a Program:
fn __add__(&self, rhs: Self) -> Self {
self.clone() + rhs
}
Obviously this requires cloning both self and rhs (when it crosses the Python->Rust boundary), which is not ideal. We might be able to make use of rhs to avoid the clone.
Alternatively, we might be better off implementing __radd__ instead, but we should benchmark the difference to find out.