Skip to main content

Base Bytecode Optimization

Base bytecode optimization generates your new Hermes bundle using the previously shipped bundle (the "base") as a reference. This was acheived by passing a flag --base-bytecode <path-to-base-bundle> to the Hermes CLI while generating the new bundle. This results in a smaller patch bundle because only the bytecode differences are transmitted (vs. the base).

Size Comparison

File Size Comparison

Bundle TypeOriginalWith DeflateWith Brotli
Uncompressed Full Bundle24.5 MB11.04 MB8.14 MB
Uncompressed Patch Bundle~24.5 MB3.82 MB2.9 MB
Uncompressed Patch Bundle With Base Bytecode~24.5 MB1.1 MB0.8 MB (96% smaller🔥)
Compatibility

Available starting from SDK v1.2.0.

Enable Base Bytecode Optimization

To use this feature, set the path to the old bundle saved in the Patch Update Guide - Step 1. You’ll use this as the base when generating the new bundle in Step 3 of the Patch Update Guide.

Either set the environment variable or use the gradle.properties file.

# Environment variable
export DOTA_BASE_BUNDLE_PATH=.dota-versions/v1.0.0-android/index.android.bundle && ./gradlew assembleRelease
# gradle.properties
dotaBaseBundlePath=.dota-versions/v1.0.0-android/index.android.bundle
info

Follow every step in the Patch Update Guide; this feature only adds one extra action just before generating the new bundle (set the base bundle path).

Note

If you are using manual bundle generation as described in Bundle Generation Guide, pass --base-bundle-path <path-to-old-bundle> to the CLI.

Disable Base Bytecode Optimization

To disable this feature, unset the DOTA_BASE_BUNDLE_PATH environment variable.

Verify Base Bytecode Optimization

To verify that the base bytecode optimization is enabled, you can check the size of the patch bundle being downloaded. Use sync API to verify the size of the patch bundle being downloaded.

codePush.sync(
{},
(status) => {
console.log(status);
},
({ receivedBytes, totalBytes }) => {
console.log(`Downloaded ${receivedBytes} of ${totalBytes} bytes`);
}
);
Base bytecode optimization enabled

✅ Setup complete. Your next bundle builds will use the saved base to produce smaller patch bundles. Continue with create‑patch and release steps in the Patch Update Guide.