Skip to content

perf: Pre-compute hugr capacity when decoding a hugr-model - #3219

Merged
aborgna-q merged 1 commit into
mainfrom
ab/perf-model-import-capacity
Sep 2, 2026
Merged

perf: Pre-compute hugr capacity when decoding a hugr-model#3219
aborgna-q merged 1 commit into
mainfrom
ab/perf-model-import-capacity

Conversation

@aborgna-q

Copy link
Copy Markdown
Collaborator

Analyse the model before allocating the hugr, so we can pass approximate capacities for its internal vectors and avoid vector reallocations during decoding.

@aborgna-q
aborgna-q force-pushed the ab/perf-model-import-capacity branch from 528901e to 49361e7 Compare August 28, 2026 15:14
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.17476% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.58%. Comparing base (3aa55e9) to head (2bdead3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/import.rs 94.17% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3219      +/-   ##
==========================================
+ Coverage   81.55%   81.58%   +0.02%     
==========================================
  Files         242      242              
  Lines       47309    47408      +99     
  Branches    40906    41005      +99     
==========================================
+ Hits        38584    38677      +93     
- Misses       6713     6716       +3     
- Partials     2012     2015       +3     
Flag Coverage Δ
python 89.39% <ø> (ø)
rust 80.36% <94.17%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aborgna-q
aborgna-q changed the base branch from ab/type-resolver-context to ab/perf-op-resolution-clones August 28, 2026 15:50
@aborgna-q
aborgna-q force-pushed the ab/perf-model-import-capacity branch from 49361e7 to c47913a Compare August 28, 2026 15:50
@codspeed-hq

codspeed-hq Bot commented Aug 28, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.17%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 43 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
serialization/big_hugr/1048576/capnp/with_extensions/encode 17.6 ms 15.4 ms +14.17%
serialization/big_hugr/1048576/capnp/without_extensions/encode 17.6 ms 15.4 ms +14.16%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ab/perf-model-import-capacity (2bdead3) with main (3aa55e9)

Open in CodSpeed

@aborgna-q
aborgna-q force-pushed the ab/perf-model-import-capacity branch from c47913a to cda8967 Compare September 1, 2026 11:06
Base automatically changed from ab/perf-op-resolution-clones to main September 1, 2026 13:05
@aborgna-q
aborgna-q force-pushed the ab/perf-model-import-capacity branch from cda8967 to 2bdead3 Compare September 1, 2026 13:05
@aborgna-q
aborgna-q marked this pull request as ready for review September 1, 2026 13:48
@aborgna-q
aborgna-q requested a review from a team as a code owner September 1, 2026 13:48
@aborgna-q
aborgna-q requested review from cqc-alec and croyzor and removed request for croyzor September 1, 2026 13:48
@aborgna-q
aborgna-q added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit e0540a1 Sep 2, 2026
53 checks passed
@aborgna-q
aborgna-q deleted the ab/perf-model-import-capacity branch September 2, 2026 12:35
This was referenced Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants