dwavesystems / dwavesystems/dwave-optimization
Make array returned by `ArraySymbol.state()` copy-on-write
- Dominant language
- C++
- Stars
- 31
- Forks
- 36
- Avg merge
- 16h 55m
- Merged PRs (30d)
- 8
Description
I have copy-on-write [on my mind](https://github.com/dwavesystems/dwave-optimization/issues/296). Now that I think about it, we should try to make the array returned by `ArraySymbol.state()` a copy-on-write array. Currently we [always return a copy](https://github.com/dwavesystems/dwave-optimization/blob/7335228aeb8492068a27b600ff2df0fb21f28b98/dwave/optimization/_model.pyx#L1729).
Of course, it might not be (easily) possible via NumPy's interface. In which case we should consider returning a readonly array.
Another challenge will be tying the lifespan of the node to the array. I.e. when the model gets garbage collected we don't want to segfault when accessing the array.
Contributor guide
Assessment
This issue has not been assessed yet.