mirror of https://github.com/astral-sh/ruff
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary When I was looking at the v0.2.0 release, this method showed up in a CodSpeed regression (we were calling it more), so I decided to quickly look at speeding it up. @BurntSushi suggested using Aho-Corasick, and it looks like it's about 7 or 8x faster: ```text Parser/AhoCorasick time: [8.5646 ns 8.5914 ns 8.6191 ns] Parser/Iterator time: [64.992 ns 65.124 ns 65.271 ns] ``` ## Test Plan `cargo test` |
||
|---|---|---|
| .. | ||
| visitor | ||
| all.rs | ||
| call_path.rs | ||
| comparable.rs | ||
| docstrings.rs | ||
| expression.rs | ||
| hashable.rs | ||
| helpers.rs | ||
| identifier.rs | ||
| imports.rs | ||
| int.rs | ||
| lib.rs | ||
| node.rs | ||
| nodes.rs | ||
| parenthesize.rs | ||
| relocate.rs | ||
| statement_visitor.rs | ||
| stmt_if.rs | ||
| str.rs | ||
| traversal.rs | ||
| types.rs | ||
| visitor.rs | ||
| whitespace.rs | ||