Conversation
hugr-core/src/hugr/linking.rs
Outdated
| NodeLinkingDirective::UseExisting(_) => Either::Right(std::iter::once(ch)), | ||
| })); | ||
| let mut roots = HashMap::new(); | ||
| // Make a fresh map here, so determinism is not affected by iteration order of the HashMap in `children` |
There was a problem hiding this comment.
This is a bit unfortunate, but NodeLinkingDirectives is a public type alias of HashMap so it would be breaking to change it, and it already gets iterated through twice so a third time can't be that bad can it? 🔥 🩹
There was a problem hiding this comment.
Happy to open an issue or PR to fix in a later breaking release if anyone feels strongly
There was a problem hiding this comment.
I think open an issue, label as "perf" and leave a comment (to aid a future profiler)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2792 +/- ##
=======================================
Coverage 83.69% 83.70%
=======================================
Files 261 261
Lines 52561 52581 +20
Branches 47307 47327 +20
=======================================
+ Hits 43991 44011 +20
Misses 6183 6183
Partials 2387 2387
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Really this just checks that things from the source hugr are added in consistent | ||
| // order (taking next available indices in the target). Actually linking them with | ||
| // nodes already (at consistent positions) in the target only reduces variability. | ||
| let (insert, _, _) = dfg_calling_defn_decl(); |
There was a problem hiding this comment.
This was a handy hugr lying around, with the entrypoint + two defns/decls being inserted as separate "trees" in a forest, there are 3!=6 possible orderings, so the test succeeded around 1 time in 6. We could decrease the odds of a false positive by inserting a bigger Hugr but it would make a longer test.
hugr-core/src/hugr/linking.rs
Outdated
| NodeLinkingDirective::UseExisting(_) => Either::Right(std::iter::once(ch)), | ||
| })); | ||
| let mut roots = HashMap::new(); | ||
| // Make a fresh map here, so determinism is not affected by iteration order of the HashMap in `children` |
There was a problem hiding this comment.
I think open an issue, label as "perf" and leave a comment (to aid a future profiler)
## 🤖 New release * `hugr-model`: 0.25.2 -> 0.25.3 (✓ API compatible changes) * `hugr-core`: 0.25.2 -> 0.25.3 (✓ API compatible changes) * `hugr-llvm`: 0.25.2 -> 0.25.3 (✓ API compatible changes) * `hugr-passes`: 0.25.2 -> 0.25.3 (✓ API compatible changes) * `hugr-persistent`: 0.4.2 -> 0.4.3 (✓ API compatible changes) * `hugr`: 0.25.2 -> 0.25.3 (✓ API compatible changes) * `hugr-cli`: 0.25.2 -> 0.25.3 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.25.0](hugr-model-v0.24.3...hugr-model-v0.25.0) - 2025-12-22 ### Bug Fixes - *(model)* avoid non abi-compatible pyo3 calls ([#2679](#2679)) ### New Features - [**breaking**] Upgrade pyo3 dependency to 0.27 ([#2736](#2736)) ### Refactor - Direct import of model representation to Python ([#2683](#2683)) </blockquote> ## `hugr-core` <blockquote> ## [0.25.3](hugr-core-v0.25.2...hugr-core-v0.25.3) - 2026-01-09 ### Bug Fixes - more nondeterminism in linking ([#2792](#2792)) ### Documentation - Add collection extension ops to the spec ([#2767](#2767)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.25.0](hugr-llvm-v0.24.3...hugr-llvm-v0.25.0) - 2025-12-22 ### New Features - *(llvm)* [**breaking**] upgrade to inkwell 0.7 ([#2695](#2695)) ### Refactor - Deprecate Value::Function and inline_constant_functions ([#2770](#2770)) </blockquote> ## `hugr-passes` <blockquote> ## [0.25.3](hugr-passes-v0.25.2...hugr-passes-v0.25.3) - 2026-01-09 ### Bug Fixes - *(hugr-passes)* Recursive replacement on NodeTemplate::LinkedHugr ([#2800](#2800)) ### Refactor - *(ReplaceTypes)* [tiny] correct computation of containing_func ([#2807](#2807)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.4.0](hugr-persistent-v0.3.4...hugr-persistent-v0.4.0) - 2025-12-22 ### New Features - [**breaking**] Remove `RootCheckable` ([#2704](#2704)) - [**breaking**] Bump MSRV to Rust 1.89 ([#2747](#2747)) - [**breaking**] Type-safe access for node metadata ([#2755](#2755)) ### Refactor - [**breaking**] Remove multiple deprecated definitions ([#2751](#2751)) </blockquote> ## `hugr` <blockquote> ## [0.25.3](hugr-v0.25.2...hugr-v0.25.3) - 2026-01-09 ### Bug Fixes - *(hugr-passes)* Recursive replacement on NodeTemplate::LinkedHugr ([#2800](#2800)) - more nondeterminism in linking ([#2792](#2792)) ### Documentation - Add collection extension ops to the spec ([#2767](#2767)) ### Refactor - *(ReplaceTypes)* [tiny] correct computation of containing_func ([#2807](#2807)) </blockquote> ## `hugr-cli` <blockquote> ## [0.25.0](hugr-cli-v0.24.3...hugr-cli-v0.25.0) - 2025-12-22 ### New Features - *(cli, python)* programmatic interface to cli with python bindings ([#2677](#2677)) - return description output to python on error ([#2681](#2681)) - [**breaking**] Type-safe access for node metadata ([#2755](#2755)) - [**breaking**] GeneratorDesc metadata definition ([#2759](#2759)) ### Refactor - [**breaking**] move envelope reading to dedicated module with dedicated errors ([#2689](#2689)) - *(cli)* [**breaking**] remove deprecated hugr_json handling ([#2690](#2690)) - [**breaking**] Remove multiple deprecated definitions ([#2751](#2751)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
## 🤖 New release * `hugr-model`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr-core`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr-llvm`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr-passes`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr-cli`: 0.25.3 -> 0.25.4 (✓ API compatible changes) * `hugr-persistent`: 0.4.3 -> 0.4.4 <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.25.0](hugr-model-v0.24.3...hugr-model-v0.25.0) - 2025-12-22 ### Bug Fixes - *(model)* avoid non abi-compatible pyo3 calls ([#2679](#2679)) ### New Features - [**breaking**] Upgrade pyo3 dependency to 0.27 ([#2736](#2736)) ### Refactor - Direct import of model representation to Python ([#2683](#2683)) </blockquote> ## `hugr-core` <blockquote> ## [0.25.3](hugr-core-v0.25.2...hugr-core-v0.25.3) - 2026-01-09 ### Bug Fixes - more nondeterminism in linking ([#2792](#2792)) ### Documentation - Add collection extension ops to the spec ([#2767](#2767)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.25.0](hugr-llvm-v0.24.3...hugr-llvm-v0.25.0) - 2025-12-22 ### New Features - *(llvm)* [**breaking**] upgrade to inkwell 0.7 ([#2695](#2695)) ### Refactor - Deprecate Value::Function and inline_constant_functions ([#2770](#2770)) </blockquote> ## `hugr-passes` <blockquote> ## [0.25.4](hugr-passes-v0.25.3...hugr-passes-v0.25.4) - 2026-01-14 ### Bug Fixes - UnpackTuple error on disconnected outputs ([#2813](#2813)) </blockquote> ## `hugr` <blockquote> ## [0.25.4](hugr-v0.25.3...hugr-v0.25.4) - 2026-01-14 ### Bug Fixes - UnpackTuple error on disconnected outputs ([#2813](#2813)) </blockquote> ## `hugr-cli` <blockquote> ## [0.25.0](hugr-cli-v0.24.3...hugr-cli-v0.25.0) - 2025-12-22 ### New Features - *(cli, python)* programmatic interface to cli with python bindings ([#2677](#2677)) - return description output to python on error ([#2681](#2681)) - [**breaking**] Type-safe access for node metadata ([#2755](#2755)) - [**breaking**] GeneratorDesc metadata definition ([#2759](#2759)) ### Refactor - [**breaking**] move envelope reading to dedicated module with dedicated errors ([#2689](#2689)) - *(cli)* [**breaking**] remove deprecated hugr_json handling ([#2690](#2690)) - [**breaking**] Remove multiple deprecated definitions ([#2751](#2751)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.4.0](hugr-persistent-v0.3.4...hugr-persistent-v0.4.0) - 2025-12-22 ### New Features - [**breaking**] Remove `RootCheckable` ([#2704](#2704)) - [**breaking**] Bump MSRV to Rust 1.89 ([#2747](#2747)) - [**breaking**] Type-safe access for node metadata ([#2755](#2755)) ### Refactor - [**breaking**] Remove multiple deprecated definitions ([#2751](#2751)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
More iteration through HashMaps keyed by source node i.e. adding source functions to the target in a different order...