ruff/crates/ruff_python_trivia/src
Charlie Marsh 9781563ef6
Add fast-path for comment detection (#9808)
## Summary

When we fall through to parsing, the comment-detection rule is a
significant portion of lint time. This PR adds an additional fast
heuristic whereby we abort if a comment contains two consecutive name
tokens (via the zero-allocation lexer). For the `ctypeslib.py`, which
has a few cases that are now caught by this, it's a 2.5x speedup for the
rule (and a 20% speedup for token-based rules).
2024-02-05 11:00:18 -05:00
..
snapshots Add fast-path for comment detection (#9808) 2024-02-05 11:00:18 -05:00
comment_ranges.rs Skip LibCST parsing for standard dedent adjustments (#9769) 2024-02-02 18:13:46 +00:00
cursor.rs Use CommentRanges in backwards lexing (#7360) 2023-09-16 03:21:45 +00:00
lib.rs Extend pragma comment cases (#7687) 2023-09-28 18:55:19 +00:00
pragmas.rs Extend pragma comment cases (#7687) 2023-09-28 18:55:19 +00:00
textwrap.rs Skip empty lines when determining base indentation (#9795) 2024-02-02 19:42:47 +00:00
tokenizer.rs Add fast-path for comment detection (#9808) 2024-02-05 11:00:18 -05:00
whitespace.rs Remove source path from parser errors (#9322) 2023-12-30 20:33:05 +00:00