# es2abc-benchmark **Repository Path**: yao_xing/es2abc-benchmark ## Basic Information - **Project Name**: es2abc-benchmark - **Description**: es2abc-benchmarks - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-15 - **Last Updated**: 2025-01-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # es2abc-benchmark ## 项目说明 本项目旨在对es2abc编译js时的性能进行测试并输出测试结果报告。 本项目依赖python3、git以及ets_frontend组件下的es2abc可执行文件。 其中测试用例默认存放在`test_cases`目录,运行结果存放在`output`目录。 ## 用法说明 ### 工具运行 #### 参数说明 --es2abc-tool:这个参数是必需的,需要提供一个es2abc工具的路径。 --case-dir:这个参数是可选的,指定测试用例路径,测试用例的目录默认值为当前路径下的test_cases目录,当所指定的路径与默认路径不同时,将不会拉取、运行默认用例。 --runs:这个参数是可选的,默认值为20。表示运行对测试用例编译的次数。 --opt-level:这个参数是可选的,它指定了编译器的优化级别。 --parse-only:这个参数是可选的,默认值为False。如果设置为True,那么在测试期间,只会解析输入文件。 #### 测试用例说明 本项目测试套件及测试用例来源于开源库: ##### 测试套件: | 名称 | 描述 | GitHub 地址 | | :--: | :--: | :--: | | Octane | JavaScript基准测试套件,用于评估浏览器在处理复杂JavaScript任务时的性能 | [https://github.com/chromium/octane](https://github.com/chromium/octane) | | Kraken | JavaScript性能测试套件,包含一系列的测试用例,涵盖了诸如动态场景、垃圾回收、加密和图形操作等方面 | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) | | SunSpider | JavaScript性能测试套件,用于评估JavaScript引擎在执行一些常见任务时的性能 | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) | ##### 测试用例: | 名称 | 描述 | GitHub 地址 | | :--: | :--: | :--: | | Three.js | 基于 WebGL 的 JavaScript 3D 库 | [https://github.com/mrdoob/three.js](https://github.com/mrdoob/three.js) | | Hashmap.js | HashMap 类实现了 map、set 和 hashmap 等数据结构的操作 | [https://github.com/flesler/hashmap](https://github.com/flesler/hashmap) | | Echarts.js | 数据可视化库 | [https://github.com/apache/echarts](https://github.com/apache/echarts) | | gl-matrix.js | 提供了许多常用的矩阵和向量计算函数 | [https://github.com/toji/gl-matrix](https://github.com/toji/gl-matrix) | | ramda.js | 函数式编程风格的 JavaScript 库,专注于提供对数组和对象的不可变操作 | [https://github.com/ramda/ramda](https://github.com/ramda/ramda) | | ml-matrix.js | 矩阵、矩阵操作和计算库 | [https://github.com/orgs/mljs](https://github.com/orgs/mljs) | | bignumber.js | 计算大型斐波那契数列的性能 | [https://github.com/MikeMcl/bignumber.js](https://github.com/MikeMcl/bignumber.js) | | numeric.js | 用于处理数值计算、矩阵运算、线性代数、插值、优化等任务 | [https://github.com/sloisel/numeric/blob/master/src/numeric.js](https://github.com/sloisel/numeric/blob/master/src/numeric.js) | #### 运行示例 脚本运行时依赖ets_frontend组件编译后的es2abc可执行文件 es2abc编译命令: ```shell $ ./build.sh --product-name rk3568 --build-target ets_frontend_build ``` 指定es2abc可执行文件,运行`run_benchmark.py`进行测试: ```shell $ python3 run_benchmark.py --es2abc-tool /out/rk3568/clang_x64/arkcompiler/ets_frontend/es2abc ``` 指定测试用例编译轮数(默认为20轮): ```shell $ python3 run_benchmark.py --es2abc-tool /out/rk3568/clang_x64/arkcompiler/ets_frontend/es2abc --runs 10 // 可修改为需要的编译轮数 ``` 只对测试用例做解析动作: ```shell $ python3 run_benchmark.py --es2abc-tool /out/rk3568/clang_x64/arkcompiler/ets_frontend/es2abc --parse-only ``` 指定编译优化等级: ```shell $ python3 run_benchmark.py --es2abc-tool /out/rk3568/clang_x64/arkcompiler/ets_frontend/es2abc --opt-level '2' ``` 生成的测试结果存放至 `output` 目录,命令行打印基本的测试信息,如: ```plain > > > benchmark running Running navier-stokes.... Running typescript.... Running mandreel.... ``` ### 注意事项 本工具依赖ets_frontend组件编译产物es2abc可执行文件,使用时需指定es2abc路径。 本工具测试用例为开源用例,测试套件在运行时自动拉取。