Skip to content

Failing test for #691#692

Open
translunar wants to merge 2 commits intonyx-space:masterfrom
translunar:juno/perf-segment-cache
Open

Failing test for #691#692
translunar wants to merge 2 commits intonyx-space:masterfrom
translunar:juno/perf-segment-cache

Conversation

@translunar
Copy link
Copy Markdown
Contributor

This provides the failing test for #691 so you can test to see what I see. :)

Juno Woods added 2 commits April 21, 2026 16:48
…g log

`summary_from_id_at_epoch` does an O(N) linear walk through every summary
in the file looking for one whose (id, epoch) range matches, and emits a
`debug!` line per non-matching candidate. Adjacent queries in the same
segment redo the entire scan; there is no last-found-segment cache analogous
to SPICE's internal segment selection table.

This test loads the bundled `earth_2025_250826_2125_predict.bpc` (37 ITRF93
segments) and queries Earth orientation at two epochs that fall in the same
segment ~21 segments deep. Both queries emit 20 identical 'not valid at'
debug records, demonstrating the linear scan is repeated each call.

Run with:
  cargo test -p anise --no-default-features --features metaload \
      --test perf_segment_cache -- --nocapture
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ICRS orientation constant and associated frame bias parameters to the constants module. It also adds a performance regression test demonstrating that segment lookups currently perform a linear scan without caching, leading to redundant work and log spam. Feedback suggests that the new ICRS constant should be integrated into the name-to-ID mapping functions to ensure proper resolution and consistency.

Comment thread anise/src/constants.rs
/// (~0.7 m at Earth's surface). ID 22 is the next sequential ID after
/// the SPICE built-in inertial frames (1-21); SPICE itself does not
/// define a separate ICRS orientation.
pub const ICRS: NaifId = 22;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The new ICRS constant should be integrated into the name-to-ID mapping functions to ensure it can be resolved by name and correctly identified in output. Specifically, add ICRS to the match statement in orientation_name_from_id (around line 283) and the string "ICRS" to id_from_orientation_name (around line 317). To maintain type safety and consistency with repository standards, ensure these match statements are exhaustive and avoid catch-all arms. Additionally, evaluate whether "ICRF" (which currently maps to J2000 at line 319) should be updated to map to ICRS to reflect the distinction being introduced between the dynamical J2000 and the kinematic ICRS/ICRF.

References
  1. When converting enums or handling variants in match statements, use exhaustive matches instead of catch-all arms to ensure all variants are explicitly handled and to improve type safety.

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.

1 participant