-
Notifications
You must be signed in to change notification settings - Fork 6
Consider hashing duplicate transition-id validation in statum-graph #14
Copy link
Copy link
Open
Description
Context
statum-graph::validate_graph(...) currently detects duplicate transition ids by storing seen ids in a Vec and calling contains(...) for each transition, which is O(n^2) in the number of transitions.
Why this is not an immediate PR blocker
- The current code is correct.
- This path is not known to be hot today.
- Switching directly to
HashSetwould tighten the external generic contract forMachineDoc::try_from_graph(...)because it would requireT: Hash, not justT: Copy + Eq.
Follow-up decision
Decide whether to:
- Keep the current external API and accept the linear scan because this is not a proven bottleneck, or
- Explicitly require
T: Hashfor the external path and switch duplicate transition-id detection to aHashSet.
Relevant code
statum-graph/src/lib.rsvalidate_graph(...)statum-core/src/introspection.rsMachineIntrospection::TransitionIdalready requiresHashfor Statum-generated graphs
Acceptance criteria
- Either document why the current
Vecapproach is intentional, or - Change the bound and implementation deliberately rather than as an incidental micro-optimization.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels