Skip to content

Version 3.0.0#9

Open
rsalmaso wants to merge 37 commits into
mainfrom
dev
Open

Version 3.0.0#9
rsalmaso wants to merge 37 commits into
mainfrom
dev

Conversation

@rsalmaso

Copy link
Copy Markdown
Owner

No description provided.

rsalmaso added 30 commits August 6, 2020 16:49
Add Color enum type and Style dataclass
Move colorize from freestanding function as Style method
The guard checked the reassigned filename and never matched.
Derive match spans from the match object instead of re-scanning
each matched line with the regex, tighten the get_line_offsets
newline scan, and render colorized lines in a single pass
Search each block with finditer pos/endpos instead of copying
the block slice (~9% faster on such files; no change for files
that fit in a single block). As a side effect, lookbehind/\A-anchored
patterns now also match correctly across block boundaries.
Stop at the first match per file and skip line-offset and context
computation entirely (only the presence of a match matters),
which is dramatically faster on match-dense files
Extract each matched line directly around the match instead of building
the whole block's line-offset table, ~3-6x faster for that output mode
rsalmaso added 7 commits June 27, 2026 11:08
Track the line number with an incrementally advanced newline cursor
instead of building the whole block's line-offset table and bisecting
it per match (~1.1x typical, up to ~1.8x on match-dense files); the
full line-offset path is now used only when context (-A/-B/-C) is requested
Each ignore source is matched as one pathspec spec instead of
rule-by-rule (~1.4x faster walking of rule-heavy trees). If the
optional `google-re2` package is installed, pathspec uses it automatically
for a further speedup; otherwise the pure-Python matcher is used
Installs google-re2, which pathspec then uses automatically to
accelerate ignore-file matching further. The default install
stays pure-Python (pathspec's built-in matcher is the fallback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant