diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-05-10 18:08:00 +0200 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-05-10 19:22:29 +0200 |
| commit | 868aa006b7f1eabffd4aec3a03555012148a7df1 (patch) | |
| tree | 164722ac37b3efb0f40bcf53925b7e79dc6493c1 /examples/rust/analyze.py | |
| parent | 2ac04cd653898786caca198726e6b9938185b76a (diff) | |
chore: slight perf improvements
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples/rust/analyze.py')
| -rw-r--r-- | examples/rust/analyze.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/rust/analyze.py b/examples/rust/analyze.py index a450a1a..a134a00 100644 --- a/examples/rust/analyze.py +++ b/examples/rust/analyze.py @@ -13,17 +13,17 @@ if len(sys.argv) < 2: file_path = sys.argv[1] # Regex to match WASM operators, adjust as necessary -operator_pattern = re.compile(r'\b[a-z0-9_]+\.[a-z0-9_]+\b') +operator_pattern = re.compile(r"\b[a-z0-9_]+\.[a-z0-9_]+\b") # Read the file -with open(file_path, 'r') as file: +with open(file_path, "r") as file: content = file.read() # Find all operators operators = operator_pattern.findall(content) # Generate sequences of three consecutive operators -sequences = [' '.join(operators[i:i+seq_len]) for i in range(len(operators) - 2)] +sequences = [" ".join(operators[i : i + seq_len]) for i in range(len(operators) - 2)] # Count occurrences of each sequence sequence_counts = Counter(sequences) |
