Repository navigation
Make full_name a cached_property - #7706
Merged
Jens Hedegaard Nielsen (jenshnielsen) merged 2 commits intoNov 20, 2026
Merged
Jens Hedegaard Nielsen (jenshnielsen) merged 2 commits into
Jens Hedegaard Nielsen (jenshnielsen) merged 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7706 +/- ##
==========================================
+ Coverage 77.76% 77.78% +0.02%
==========================================
Files 308 308
Lines 32855 32888 +33
==========================================
+ Hits 25549 25582 +33
Misses 7306 7306 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
In examples without instrument communication / significant data
storage full_name contributes significantly to runtime of
measurements. E.g. In an example such as
dond(
LinSweep(dac.ch1, start=0, stop=1, num_points=50000),
dmm.v1(),
show_progress=False,
)
It contributes 4 s out of 30 s to the runtime.
Keep the public full_name a read-only property, since overriding a property with a cached_property (or vice versa) is rejected by pyright, and cached_property on top of abstractmethod drops the abstractness. Only cache the name if the component and all its parents use the default name_parts and short_name, which only depend on attributes set at creation. Subclasses that override these, e.g. to rename a module after its children were created, keep computing the name on every access. Do not cache the name of Function, whose name is a mutable public attribute. Add an asv benchmark for station snapshots and Measurement.run, tests for names after close and for overridden naming, and a newsfragment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Jens Hedegaard Nielsen (jenshnielsen)
force-pushed
the
full_name_to_cached_property
branch
from
November 19, 2026 11:45
0b9354d to
ddd037a
Compare
Jens Hedegaard Nielsen (jenshnielsen)
marked this pull request as ready for review
November 19, 2026 11:45
Jens Hedegaard Nielsen (jenshnielsen)
requested a review
from a team
as a code owner
November 19, 2026 11:45
Jens Hedegaard Nielsen (jenshnielsen)
requested a balanced review from Copilot
November 19, 2026 11:49
Copilot started reviewing on behalf of
Jens Hedegaard Nielsen (jenshnielsen)
November 19, 2026 11:50
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the conditional name-caching changes.
No open issues 🎉
What changed in this PR
This PR reduces name-resolution overhead in QCoDeS by caching full_name for components with default, static naming while preserving dynamic name resolution for overridden naming properties.
Changes:
- Add conditional name caching for instruments, modules, channel tuples, and parameters.
- Add regression tests for dynamic naming and name resolution after instrument closure.
- Add station snapshot and measurement-startup benchmarks, plus a release note describing the performance improvement.
| File | Description |
|---|---|
tests/test_instrument.py |
Test dynamic naming and name resolution after closure. |
tests/parameter/test_parameter_basics.py |
Test uncached names when parameter naming is overridden. |
src/qcodes/parameters/parameter_base.py |
Cache parameter names when parameter and instrument naming are static. |
src/qcodes/instrument/instrument_base.py |
Add conditional caching for instrument names. |
src/qcodes/instrument/channel.py |
Extend caching checks to modules and channel tuples. |
docs/changes/newsfragments/7706.improved |
Document caching behavior and snapshot performance gains. |
benchmarking/benchmarks/station.py |
Benchmark snapshots and measurement startup with nested instruments. |
Review effort: Balanced
Jens Hedegaard Nielsen (jenshnielsen)
enabled auto-merge
November 19, 2026 12:01
Cina Arjmand (CinaArjmand)
approved these changes
Nov 20, 2026
Jens Hedegaard Nielsen (jenshnielsen)
deleted the
full_name_to_cached_property
branch
November 20, 2026 13:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In examples without instrument communication / significant data storage full_name contributes significantly to runtime of measurements.
TODO