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`