Skip to content

Use generation sentinel for transform cache validity and add tests to prevent stale-cache leaks - #3

Merged
TiernanDeFranco merged 1 commit into
mainfrom
codex/find-optimization-opportunities-in-engine-core
May 7, 2026
Merged

Use generation sentinel for transform cache validity and add tests to prevent stale-cache leaks#3
TiernanDeFranco merged 1 commit into
mainfrom
codex/find-optimization-opportunities-in-engine-core

Conversation

@TiernanDeFranco

Copy link
Copy Markdown
Collaborator

Motivation

  • Remove separate "valid" byte vectors and rely on the node generation field to determine whether a cached global transform is valid, preventing stale cache state when slots are reused.

Description

  • Removed global_transform_2d_valid and global_transform_3d_valid fields from TransformRuntimeState and their initialization in new.
  • Changed the initial resize value of global_transform_*_generation to use u32::MAX as a sentinel instead of 0 in ensure_global_2d_capacity and ensure_global_3d_capacity.
  • Simplified cache-validity checks to compare global_transform_*_generation against id.generation() and removed writes of the removed valid flags when recomputing globals in get_global_transform_2d and get_global_transform_3d.
  • Added unit tests in rt_ctx_nodes_transform_api_tests.rs to ensure removed-node cache entries do not leak into reused slot generations and that recomputations overwrite old cached transforms for both 2D and 3D.

Testing

  • Ran the unit test suite including the new tests in rt_ctx_nodes_transform_api_tests.rs via cargo test; the tests for reused-slot cache behavior and recompute behavior passed.

Codex Task

@TiernanDeFranco
TiernanDeFranco merged commit bc5431e into main May 7, 2026
1 check passed
@TiernanDeFranco
TiernanDeFranco deleted the codex/find-optimization-opportunities-in-engine-core branch May 7, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant