Skip to content

Lazy Evaluation with Streaming Parser for Large Files #205

Description

@Kingflint

Current findall() loads all matches into memory. For large files (GB+), this causes OOM errors.

Feature Request
Implement lazy evaluation for findall() that yields results without loading entire file
Add Parser.findall_lazy(file_handle, chunk_size=8192) method
Support backtracking across chunk boundaries for multi-line patterns
Handle partial matches at chunk edges
Maintain accurate span positions across chunks

Test Complexity
Mock file objects with gigabyte-size data
Edge cases: pattern split across chunks
Memory profiling tests
Performance benchmarks vs current implementation

Why Complex
Requires buffer management for patterns spanning chunk boundaries
Need to maintain accurate byte offsets
Must handle regex backtracking across chunks
Complex state machine for partial match handling

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions