Skip to content

Look up IDS metadata by type, not by location string - #108

Merged
jmcclena merged 2 commits into
masterfrom
fix/units_satellite_ids
Aug 12, 2026
Merged

Look up IDS metadata by type, not by location string#108
jmcclena merged 2 commits into
masterfrom
fix/units_satellite_ids

Conversation

@mgyoo86

@mgyoo86 mgyoo86 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

A few functions took an IDS, built a universal-location string from it, and then resolved that string back to a type to look up _all_info. The round-trip works inside IMASdd, but it is slower, allocates more, and the string does not identify a type — IMASdd.summary__code and IFEdd.summary__code both map to summary.code, so satellite-owned IDSs either threw UndefVarError or silently resolved against IMASdd's entry.

_all_info is keyed by (Type, Symbol). When the type is already in hand it is the exact key, so these now look it up directly — safer and faster.

Changes

  • units(::IDS, ::Symbol)info(ids, field).units
  • cocos_transform(::IDS, ::Symbol)info(ids, field).cocos_transform
  • get_frozen_strict_property, both methods → info(ids, field).extra

units(::String) and cocos_transform(::String) are unchanged — a location string is still the right input when no type is available.

Displaying a satellite container, and imas2json(dd; strict=true) on one, now work instead of throwing. Verified against the old route across a full IMASdd.dd() walk: identical results everywhere.

Benchmark

before after
metadata lookup 891 ns, 8 alloc 162 ns, 3 alloc
imas2json(strict=true) 623 µs, 3533 alloc 569 µs, 3196 alloc

`units(::IDS, ::Symbol)` routed through the universal-location string, which
resolves the struct name inside IMASdd. Any IDS owned by a satellite data
dictionary threw `UndefVarError` even though it is registered in `_all_info`.
`show` calls units per field, so displaying a satellite container failed.

Look the field up by type through the existing `info(::IDS, ::Symbol)` instead.
`cocos_transform(::IDS, ::Symbol)` and the strict branch of
`get_frozen_strict_property` built a universal-location string and resolved
the struct name back inside IMASdd, the same round-trip already removed from
`units`. Satellite-owned IDSs threw `UndefVarError` there, which made
`imas2json(dd; strict=true)` fail outright for a satellite container.

`_all_info` is keyed by `(Type, Symbol)`, so the type in hand is the exact
key; the string is a lossy projection of it — two containers can share one
location. Verified across a full dd walk (28,181 fields, IDSvector elements
materialized): units, .extra and cocos_transform are identical to the string
route everywhere, and the returned `Info` objects are `===`.

Strict export also gets cheaper: 623 to 569 us, 337 fewer allocations.

The satellite fixture now registers `global_time` on its own container, as a
generated satellite does — previously it leaned on the silent fallback to
IMASdd.dd that this change removes.
@mgyoo86
mgyoo86 requested a review from jmcclena August 11, 2026 17:22
@mgyoo86

mgyoo86 commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

@jmcclena
FUSE CI is running here

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.93%. Comparing base (0634709) to head (a008c25).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #108   +/-   ##
=======================================
  Coverage   43.92%   43.93%           
=======================================
  Files          16       16           
  Lines       31551    31551           
=======================================
+ Hits        13859    13862    +3     
+ Misses      17692    17689    -3     

☔ 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.

@jmcclena

Copy link
Copy Markdown
Member

@mgyoo86 Why does it say that "The round-trip works inside IMASdd, but it is slower, allocates more", but the benchmarks are showing faster times with less allocations?

@mgyoo86

mgyoo86 commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

@jmcclena

The round-trip works inside IMASdd, but it is slower, allocates more

This describes master's behavior that uses ulocation under the hood.
Since ulocation searches the path to the target ids and creates temporary String, allocating temporary memory and so making it slower.

This PR changes the behavior by directly using the target ids (already given as a function arg), avoiding the unneccessary cost for the temporary string stuff.

The benchmark is showing the performance difference between those two implementations.

You can consider this PR a performance improvement PR for IMASdd.
At the same time, this PR also allows the satellite package work without messing around IMASdd's path name.

@jmcclena
jmcclena merged commit c73094b into master Aug 12, 2026
10 checks passed
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