From 868aa006b7f1eabffd4aec3a03555012148a7df1 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Fri, 10 May 2024 18:08:00 +0200 Subject: chore: slight perf improvements Signed-off-by: Henry Gressmann --- examples/rust/analyze.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/rust') 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) -- cgit v1.3.1