| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| test_cases/ | 22-Oct-2025 | - | 2,613 | 1,067 | ||
| README-zh.md | D | 22-Oct-2025 | 2.1 KiB | 88 | 55 | |
| README.md | D | 22-Oct-2025 | 2.3 KiB | 87 | 55 | |
| pg.cfg | D | 22-Oct-2025 | 107 | 7 | 6 | |
| size_compare.py | D | 22-Oct-2025 | 14.4 KiB | 407 | 332 |
README-zh.md
1# 环境准备 2 3## JDK 4 5这里以 openjdk11 为例子进行安装。 6 7```sh 8sudo apt update 9sudo apt install openjdk-11-jdk 10``` 11 12安装完成可以通过下面指令检查: 13 14```sh 15javac --version 16``` 17 18输出内容如下 19 20```sh 21javac 11.0.21 22``` 23 24## d8 25 26d8工具作为独立工具被纳入了 Android Studio 构建工具 28.0.1 及更高版本中。因此通过下载安装 Android Studio 工具就可以获取到d8工具。 27 281. 下载 Android Studio: 29 30```sh 31wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2023.2.1.24/android-studio-2023.2.1.24-linux.tar.gz 32``` 33 342. 解压 35 36```sh 37tar -xzvf android-studio-2023.1.1.28-linux.tar.gz 38``` 39 403. 启动 Android Studio 41 42```sh 43cd android-studio/bin 44./studio.sh 45``` 46 474. 配置国内镜像源 (如果此时提示无法下载 Android SDK) 48 49+ 进入到 Android Studio 主页面,点击下方的 `More Actions` -> `SDK Manager`。 50+ 找到左侧的: `Appearance & Behavior` -> `System Settings` -> `HTTP Proxy`。 51+ 选择 `Auto-detect proxy settings`,并勾选 `Automatic proxy configuration URL`。在后面的输入框中填写镜像源地址,镜像源可选URL如下: 52 53```sh 54https://mirrors.aliyun.com/android.googlesource.com/ 55 56https://mirrors.cloud.tencent.com/AndroidSDK/ 57``` 58 59随后重新启动 Android Studio 即可顺利下载到 Android SDK。 60 61Android SDK路径: `~/Android/Sdk/build-tools/`。d8可执行程序就在该目录的版本号目录下面。 62 63# 简介 64 65输出 js / ts / java 测试用例分别通过 es2abc / es2abc / javac和d8 编译生成字节码文件大小的对比报告。 66 67# 运行脚本 68 69## 使用说明 70 71```sh 72python3 size_compare.py --es2abc-path ES2ABC_PATH --javac-path JAVAC_PATH [arguments] 73``` 74 75### 参数 76 77+ `--es2abc-path`: 可执行程序 es2abc 的路径。 78+ `--javac-path`: 可执行程序 javac 的路径。 79 80### 可选参数 81 82+ `--d8-path`: 可执行程序 d8 的路径。 83+ `--timeout`: 用例执行的时间限制 (单位: 秒)。 84 85# 测试结果 86 87字节码文件大小对比报告: `./size_comparison_report.html` 88
README.md
1# Prepare Environment 2 3## JDK 4 5Here's an example of an openjdk11 installation. 6 7```sh 8sudo apt update 9sudo apt install openjdk-11-jdk 10``` 11 12The completion of the installation can be checked by the following command. 13 14```sh 15javac --version 16``` 17 18The output looks like this: 19 20```sh 21javac 11.0.21 22``` 23 24## d8 25 26The d8 tool is included as a standalone tool in the Android Studio build tool version 28.0.1 and higher. Therefore, you can get the d8 tool by downloading and installing the Android Studio tools. 27 281. Download Android Studio: 29 30```sh 31wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2023.2.1.24/android-studio-2023.2.1.24-linux.tar.gz 32``` 33 342. Decompress 35 36```sh 37tar -xzvf android-studio-2023.1.1.28-linux.tar.gz 38``` 39 403. Launch Android Studio 41 42```sh 43cd android-studio/bin 44./studio.sh 45``` 46 474. Configure a domestic mirror source (If you are prompted to download the Android SDK at this point) 48 49+ Go to the main Android Studio page and click on the lower button: `More Actions` -> `SDK Manager`。 50+ Find the left side: `Appearance & Behavior` -> `System Settings` -> `HTTP Proxy`。 51+ Select `Auto-detect proxy settings`,And then check `Automatic proxy configuration URL`。Fill in the mirror source address in the input box at the end, the optional URLs of the mirror source are as follows: 52 53```sh 54https://mirrors.aliyun.com/android.googlesource.com/ 55 56https://mirrors.cloud.tencent.com/AndroidSDK/ 57``` 58 59Then restart Android Studio to download the Android SDK without any problems. 60 61Android SDK Path: `~/root/Android/Sdk/build-tools/`. The d8 executable program is located in the version number directory of the directory. 62 63# Introduction 64 65Generate a comparison report of bytecode file sizes generated by es2abc / es2abc / javac and d8 compilation for the js / ts / java test cases, respectively. 66 67# Running the Script 68 69## Usage 70 71```sh 72python3 size_compare.py --es2abc-path ES2ABC_PATH --javac-path JAVAC_PATH [arguments] 73``` 74 75### Tail arguments 76 77- `--es2abc-path`: Path to the executable program es2abc. 78- `--javac-path`: Path to the executable program javac. 79 80### Optional arguments 81 82- `--d8-path`: Path to the executable program d8. 83- `--timeout`: Time limits for use case execution (In seconds). 84 85# Test Result 86 87Bytecode file size comparison report: `./size_comparison_report.html`