testcafe-0001: Selector filterNodes (string-filter branch) and expandSelectorResults both dedup via Array.indexOf on growing result arrays. filterNodes: O(N*M) per selector filter. expandSelectorResults: O(N^2 * K^2) worst case when derivatives unique. Fix: Set<Node> keyed by object identity. Bench: 398x at N=2000 filter, 1966x at N=K=150 expand. webdriverio-0002: MSPO aggregator dedups per-test entries via Array.find on growing bucket array. O(N^2) per test bucket, same pattern repeats in unknown-suite merger. Fix: companion Map<bucketKey, Set<selector>> for O(1) dedup. Bench: 493x at N=2000. UNDF IDs: 1290 (testcafe), 1291 (webdriverio-0002). All 17 tests pass.
34 lines
802 B
Python
34 lines
802 B
Python
#!/usr/bin/env python3
|
|
# run_all.py -- run testcafe bench scripts and write results.txt
|
|
|
|
import importlib.util
|
|
import os
|
|
import sys
|
|
|
|
BENCH_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
def load_module(filename):
|
|
path = os.path.join(BENCH_DIR, filename)
|
|
spec = importlib.util.spec_from_file_location("mod", path)
|
|
mod = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(mod)
|
|
return mod
|
|
|
|
|
|
all_lines = []
|
|
|
|
for fname in ["bench-testcafe-0001.py"]:
|
|
mod = load_module(fname)
|
|
lines = mod.run()
|
|
all_lines.extend(lines)
|
|
all_lines.append("")
|
|
print()
|
|
sys.stdout.flush()
|
|
|
|
out_path = os.path.join(BENCH_DIR, "results.txt")
|
|
with open(out_path, "w") as f:
|
|
f.write("\n".join(all_lines) + "\n")
|
|
|
|
print(f"results written to {out_path}")
|
|
sys.stdout.flush()
|