Skip to content

perf: Improve DFA state storage during DFA generation. #190

@SharafMohamed

Description

@SharafMohamed

Request

Currently DFA states are stored in an ordered map during generation. For each lookup this, has a complexity of logN, which starts to add up as the number of states increases. This is specifically an issue with large numbers of captures, as this causes the number of states to grow quickly. For example, with 50 variables, containing a total of 70 capture groups, the generation time takes ~10s.

Instead, using another data structure, most likely an unordered map, with fast insertion and lookup, would be ideal, as maintaining the order is not required.

Possible implementation

If no simpler data structure can resolve the issue:

  • Create hash functions for the DFA state class, and its member's classes.
  • Use an unordered_map or use existing hash libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions