Skip to content

Commit

Permalink
Add note about performance of tidy problematic consts
Browse files Browse the repository at this point in the history
  • Loading branch information
Noratrieb committed Jul 7, 2024
1 parent 76ba119 commit 1cfc89a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tools/tidy/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const ROOT_PROBLEMATIC_CONSTS: &[u32] = &[
173390526, 721077,
];

// Returns all permutations of problematic consts, over 2000 elements.
fn generate_problematic_strings(
consts: &[u32],
letter_digit: &FxHashMap<char, char>,
Expand Down Expand Up @@ -319,6 +320,8 @@ pub fn check(path: &Path, bad: &mut bool) {
ROOT_PROBLEMATIC_CONSTS,
&[('A', '4'), ('B', '8'), ('E', '3')].iter().cloned().collect(),
);
// This creates a RegexSet as regex contains performance optimizations to be able to deal with these over
// 2000 needles efficiently. This runs over the entire source code, so performance matters.
let problematic_regex = RegexSet::new(problematic_consts_strings.as_slice()).unwrap();

walk(path, skip, &mut |entry, contents| {
Expand Down

0 comments on commit 1cfc89a

Please sign in to comment.