ruff
9781563e - Add fast-path for comment detection (#9808)

Commit
1 year ago
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).
Author
Parents
Loading