feat: Add unsafe array take and put operations
I'm reluctant to add this, but this should remove the need for people to use option-arrays.
Questions:
- Is
puta good name? - Should the names include an
_unsafesuffix?
Codecov Report
:x: Patch coverage is 87.30159% with 8 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 93.55%. Comparing base (495aba5) to head (1b3bc7b).
:warning: Report is 3 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| guppylang/src/guppylang/std/array.py | 61.90% | 8 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1165 +/- ##
==========================================
- Coverage 93.59% 93.55% -0.04%
==========================================
Files 128 128
Lines 11451 11503 +52
==========================================
+ Hits 10717 10762 +45
- Misses 734 741 +7
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This is waiting on an updated implementation using borrow array, which requires a "check" HUGR operation https://github.com/CQCL/hugr/issues/2569
My main comment is that this makes the analysis for borrow-return "squashing" substantially harder (and/or less effective). See https://github.com/CQCL/tket2/pull/1159 . Doesn't mean we can't do this, but we may want to hold off.
UPDATE: I've reduced scope of that squashing meaning that it is now "safe" even given this PR, although https://github.com/CQCL/tket2/issues/1176 would still be useful (not essential).
Bencher Report
| Branch | feat/array-unsafe |
| Testbed | Linux |
Click to view all benchmark results
Bencher Report
| Branch | feat/array-unsafe |
| Testbed | Linux |
Click to view all benchmark results
| Benchmark | hugr_bytes | Benchmark Result bytes x 1e3 (Result Δ%) | Upper Boundary bytes x 1e3 (Limit %) | hugr_nodes | Benchmark Result nodes (Result Δ%) | Upper Boundary nodes (Limit %) |
|---|---|---|---|---|---|---|
| tests/benchmarks/test_big_array.py::test_big_array_compile | 📈 view plot 🚷 view threshold | 143.70 x 1e3(0.00%)Baseline: 143.70 x 1e3 | 145.13 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 6,590.00(0.00%)Baseline: 6,590.00 | 6,655.90 (99.01%) |
| tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile | 📈 view plot 🚷 view threshold | 21.67 x 1e3(0.00%)Baseline: 21.67 x 1e3 | 21.89 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 606.00(0.00%)Baseline: 606.00 | 612.06 (99.01%) |
What should be the suffix for the panicking versions?
How about making put and take the panicking versions and make the fallible versions try_take and try_put ?
How about making put and take the panicking versions and make the fallible versions try_take and try_put ?
Actually, that sounds like a good option 👍