• Home
Name Date Size #Lines LOC

..--

README.mdD12-May-20245.1 KiB6559

README_zh.mdD12-May-20243.8 KiB6761

config.pyD12-May-20245.5 KiB152139

run_benchmark.pyD12-May-20248.2 KiB187165

utils.pyD12-May-20247.6 KiB218178

README.md

1# es2abc-benchmark
2
3## Project Description
4The purpose of this project is to test the performance of es2abc when compiling JS and output a report of the test results.
5This tool relies on Python3, Git, and the es2abc executable file under the ets_frontend component.
6By default, test cases are stored in the 'test_cases' directory, and run results are stored in the 'output' directory.
7## Usage notes
8#### Parameter description
9|   Parameter   |                         Description                          |  Type   |            Default Value            |
10| :-----------: | :----------------------------------------------------------: | :-----: | :---------------------------------: |
11| --es2abc-tool | This parameter is required and requires a path to the es2abc tool to be provided. | string  |                 N/A                 |
12|    --runs     | This parameter is optional and the default value is 20. Represents the number of times a use case was executed in a test. |   int   |                 20                  |
13|  --opt-level  | This parameter is optional and specifies the optimization level of the compiler. | string  |                  0                  |
14| --parse-only  | This parameter is optional and the default value is False. If set to True, only the input file will be parsed during testing. | boolean |                False                |
15| --engine-comp  | This parameter is optional, and the default value is False. At this time, only the es2abc test is performed. When it is True, it is compared with the Hermes engine. | boolean |                False                |
16
17#### Description of the test case
18    The test suite and test cases for this project are sourced from open source libraries:
19#### Test Suite:
20  | name |                                                                                                            description                                                                                                            | GitHub address |
21  | :--: |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| :--: |
22  | Octane |                                                          JavaScript benchmarking suite for evaluating the performance of browsers in handling complex JavaScript tasks.                                                           | [https://github.com/chromium/octane](https://github.com/chromium/octane) |
23  | Kraken |                                     JavaScript performance test suite, including a series of test cases covering dynamic scenarios, garbage collection, encryption, and graphics operations.                                      | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) |
24  | SunSpider |                                                     JavaScript performance testing suite, used to evaluate the performance of JavaScript engines in performing common tasks.                                                      | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) |
25#### Comparison Engine
26    When running this benchmark, you can compare the performance of es2abc compilation with that of Hermes compilation. Hermes engine GitHub address: https://github.com/facebook/hermes
27
28#### Run an example
29The script runtime depends on the es2abc executable after the ets_frontend component is compiled. es2abc compilation command:
30```
31$ ./build.sh --product-name rk3568 --build-target ets_frontend_build
32```
33Specify the es2abc executable and run the 'run_benchmark.py' for testing:
34```
35$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc
36```
37Compare with Hermes Engine:
38```
39$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --engine-comp
40```
41Specify the number of rounds of test case compilation (20 rounds by default):
42```
43$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --runs 10  // It can be modified to the required number of compilation rounds
44```
45--parse-only only parses the test case, and when the --engine-comp parameter is used, this parameter is invalid:
46```
47$  python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --parse-only
48```
49--opt-level specifies the compilation optimization level, and when the --engine-comp parameter is used, this parameter is invalid:
50```
51$  python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --opt-level '2'
52```
53The generated test results are stored in the 'output' directory, and the command line prints basic test information, such as:
54
55```plain
56> > > benchmark running
57Running navier-stokes....
58Running typescript....
59Running mandreel....
60```
61### Precautions
62    This tool relies on ets_frontend components to compile the es2abc executable file. and you need to specify the es2abc path when using it.
63    The test cases for this tool are open source cases, and the test suite is automatically pulled during run time.
64
65

README_zh.md

1# es2abc-benchmark
2
3## 项目说明
4 本项目旨在对es2abc编译js时的性能进行测试并输出测试结果报告。
5 本项目依赖python3、git以及ets_frontend组件下的es2abc可执行文件。
6 其中测试用例默认存放在`test_cases`目录,运行结果存放在`output`目录。
7## 用法说明
8### 工具运行
9#### 参数说明
10|     参数      |                         描述                          |  类型  |                  默认值                  |
11| :-----------: |:---------------------------------------------------:| :----: | :--------------------------------------: |
12| --es2abc-tool |             这个参数是必需的,需要提供一个es2abc工具的路径。             | string |                   N/A                    |
13|    --runs     |           这个参数是可选的,默认值为20。表示一次测试中执行用例的次数。           |  int   |                    20                    |
14|  --opt-level  |               这个参数是可选的,它指定了编译器的优化级别。                | string |                    0                     |
15| --parse-only  |   这个参数是可选的,默认值为False。如果设置为True,那么在测试期间,只会解析输入文件。    |  bool  |                  False                   |
16| --engine-comp  | 这个参数是可选的,默认值为False,此时,只进行es2abc测试,为True时与Hermes引擎对比 |  bool  |                  False                   |
17#### 测试用例说明
18    本项目测试套件及测试用例来源于开源库:
19##### 测试套件:
20  | 名称 | 描述 | GitHub 地址 |
21  | :--: | :--: | :--: |
22  | Octane | JavaScript基准测试套件,用于评估浏览器在处理复杂JavaScript任务时的性能 | [https://github.com/chromium/octane](https://github.com/chromium/octane) |
23  | Kraken | JavaScript性能测试套件,包含一系列的测试用例,涵盖了诸如动态场景、垃圾回收、加密和图形操作等方面 | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) |
24  | SunSpider | JavaScript性能测试套件,用于评估JavaScript引擎在执行一些常见任务时的性能 | [https://github.com/mozilla/krakenbenchmark.mozilla.org](https://github.com/mozilla/krakenbenchmark.mozilla.org) |
25
26#### 对比引擎
27    运行本benchmark时可进行es2abc编译性能与hermes编译性能对比,hermes引擎GitHub地址:https://github.com/facebook/hermes
28#### 运行示例
29脚本运行时依赖ets_frontend组件编译后的es2abc可执行文件
30es2abc编译命令:
31
32```
33$ ./build.sh --product-name rk3568 --build-target ets_frontend_build
34```
35指定es2abc可执行文件,运行`run_benchmark.py`进行测试:
36```
37$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc
38```
39与hermes引擎进行对比:
40```
41$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --engine-comp
42```
43指定测试用例编译轮数(默认为20轮):
44```
45$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --runs 10
46```
47--parse-only 只对测试用例做解析动作,使用参数 --engine-comp时,本参数失效:
48```
49$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --parse-only
50```
51--opt-level 指定编译优化等级,使用参数 --engine-comp时,本参数失效:
52```
53$ python3 run_benchmark.py --es2abc-tool  /out/xx/xx/xx/ets_frontend/es2abc --opt-level '2'
54```
55生成的测试结果存放至 `output` 目录,命令行打印基本的测试信息,如:
56
57```plain
58> > > benchmark running
59Running navier-stokes....
60Running typescript....
61Running mandreel....
62```
63### 注意事项
64    本工具依赖ets_frontend组件编译产物es2abc可执行文件,使用时需指定es2abc路径。
65    本工具测试用例为开源用例,测试套件在运行时自动拉取。
66
67