mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
d44c8f1f29
- 问题: QuickJS run-test262 要求 test262/harness/testBigIntTypedArray.js,但该文件实际在 test/esnext/harness/ 下 - 修复: bench_test262_qjs() 在跑 run-test262 前,自动把 tests/test262/test/esnext/harness/*.js 链接/拷贝到 baseline-quickjs/test262/harness/ - 影响: QuickJS baseline 跑完整个 test262 suite,不再中途挂死 (cherry picked from commit 0660614b95974bef3af2fb598a6e79ab1515b2ff)
OxideJS Benchmark Suite
自动编译 + 全量基准测试 + AI Agent 适配度评分(QuickJS = 80 分基准)。
目录结构
benchmark/
├── README.md
├── build.sh # 一键构建 (Rust + QuickJS + 依赖安装)
├── run_benchmark.py # 全量测试脚本
└── fetch_test262.sh # 下载 test262 测试套件
脚本自动检测仓库内资源:
../— OxideJS Rust 源码../baseline-quickjs/— QuickJS 源码(放这里自动编译)../tests/stress/— JS 压测脚本../tests/test262/test/— test262 套件(缺则运行 fetch_test262.sh)
快速开始
# 1. 确保 QuickJS 源码在 baseline-quickjs/
git submodule add https://github.com/bellard/quickjs.git baseline-quickjs
# 或手动放入
# 2. 确保 stress 测试在 tests/stress/
# (仓库已自带)
# 3. 构建
bash benchmark/build.sh
# 4. 下载 test262 (首次,约 500MB)
bash benchmark/fetch_test262.sh
# 5. 运行全量测试
python3 benchmark/run_benchmark.py
输出
benchmark/results/
├── report.md # Markdown 报告
└── data.json # 原始数据
评分体系
| 维度 | 满分 | QuickJS基准 | 逻辑 |
|---|---|---|---|
| 延迟 | 20 | 16 | 16 × (QJS_ms / Oxide_ms) |
| 资源 | 15 | 12 | 12 × (QJS_mem / Oxide_mem) |
| 隔离 | 12 | 12 | step-limit + VM池 |
| 清洁度 | 12 | 12 | 正常代码 stderr=0 |
| 语法覆盖 | 15 | 12 | 12 × (Oxide_rate / 99%) |
| 错误质量 | 10 | 10 | 错误信息可调试 |
| 启动 | 10 | 8 | 8 × (0.15ms / Oxide_cold) |
| 确定性 | 6 | 6 | 多次执行方差 |
| 总分 | 100 | 80 | 优于QuickJS可超80 |
依赖
build.sh 自动检测并安装(支持 apt/dnf/yum/pacman/apk/zypper):
- gcc make git python3 curl
- Rust 工具链 (自动 via rustup)
- Python psutil (可选)