diff --git a/syncode/mask_store/byte_fsm.py b/syncode/mask_store/byte_fsm.py index a00845fd..7bef1733 100644 --- a/syncode/mask_store/byte_fsm.py +++ b/syncode/mask_store/byte_fsm.py @@ -341,18 +341,14 @@ def consume_prefix(self, data: Union[str, bytes], current_state: Optional[Any] = if not state_transitions: # No transitions - dead state break - # Direct byte transition - most common case first - if byte in state_transitions: - cur_state = state_transitions[byte] + # Only get category if needed - reduces _get_category calls + category = self._get_category(byte) + if category is not None and category in state_transitions: + cur_state = state_transitions[category] else: - # Only get category if needed - reduces _get_category calls - category = self._get_category(byte) - if category is not None and category in state_transitions: - cur_state = state_transitions[category] - else: - # No valid transition - we've reached a "dead" state - cur_state = None - break + # No valid transition - we've reached a "dead" state + cur_state = None + break # Check if we're in a final state - using cached method if is_final(cur_state):