Skip to content

perf: context-mode search falls back to sequential iteration #71

Description

@shengyfu

Problem

In \serve.rs, when \�efore_context > 0 || after_context > 0, the search falls back from \par_iter()\ to sequential \iter()\ to preserve output ordering. This makes context-mode searches 4-8x slower than non-context searches.

Proposed Fix

Use \par_iter().enumerate()\ to search in parallel, then sort by index to restore file order. This preserves ordering while keeping parallel speedup.

Impact

4-8x speedup for searches using -B/-A\ context flags.

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