Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions syncode/mask_store/byte_fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down