From 1cea3578b299d1b947fcd74c69f4e917c6488ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E7=89=B9=E6=AF=8F=E7=BE=8A=E9=98=9F?= Date: Sun, 28 Jun 2026 00:54:04 +0800 Subject: [PATCH] fix: avoid division-by-zero when QuickJS test262 returns empty (cherry picked from commit fdfe9dd2a12b87b8fde474fbdd5a389a5b72753d) --- benchmark/run_benchmark.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmark/run_benchmark.py b/benchmark/run_benchmark.py index 697bcc0..c05def8 100644 --- a/benchmark/run_benchmark.py +++ b/benchmark/run_benchmark.py @@ -334,12 +334,14 @@ def report(all_data): if ox: o_pass = ox.get("pass", 0); o_fail = ox.get("fail", 0); o_ran = o_pass + o_fail q_pass = qj.get("pass", 0) if qj else 42000 + q_fail = qj.get("fail", 0) if qj else 1000 + o_rate = o_pass/o_ran*100 if o_ran else 0 w("## Test262\n") w("| | OxideJS | QuickJS |") w("|------|---------|------|") w(f"| Pass | {o_pass:,} | {q_pass:,} |") - w(f"| Fail | {o_fail:,} | {qj.get('fail', 0):,} |") - w(f"| Rate | {o_pass/o_ran*100:.1f}% | ~99% |") + w(f"| Fail | {o_fail:,} | {q_fail:,} |") + w(f"| Rate | {o_rate:.1f}% | ~99% |") w("") # Timing