shorebird icon indicating copy to clipboard operation
shorebird copied to clipboard

fix: Slow encode & save image file in only patch mode on iOS

Open 0x01001 opened this issue 7 months ago • 3 comments

App ID: 92d20fb5-52f6-40c3-beb8-7cb4cd31e3b2

Description

The encodeJpgFile function (lib: image-4.1.3) encodes an image to a JPG file and saves it. In Shorebird release mode, it takes about 100-200ms, but in Shorebird patch mode, this function takes 5-7 seconds to run. Has anyone found a solution for this case?

Cmd: shorebird release ios --flutter-version=3.24.5 --no-confirm --artifact apk -t lib/main.dart --flavor dev --dart-define-from-file=config/dev.json --export-options-plist=ios/export_options_dev.plist shorebird patch ios --release-version=1.0.0+22 --no-confirm -t lib/main.dart --flavor dev --dart-define-from-file=config/dev.json

Expected Behavior

run encodeJpgFile in patch mode same release mode

Additional Context

Shorebird 1.6.36 • [email protected]:shorebirdtech/shorebird.git Flutter 3.29.3 • revision 7c1c25e48e6dd849c3264588346aa63652d5e426 Engine • revision 59f6f7280ef9296791857b608b93d3a2c020d477

Logs: /Users/xxx/Library/Application Support/shorebird/logs Android Toolchain • Android Studio: /Applications/Android Studio.app/Contents • Android SDK: /Users/xxx/Library/Android/sdk • ADB: /Users/xxx/Library/Android/sdk/platform-tools/adb • JAVA_HOME: /Applications/Android Studio.app/Contents/jbr/Contents/Home • JAVA_EXECUTABLE: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • JAVA_VERSION: openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) OpenJDK 64-Bit Server VM (build 17.0.6+0-17.0.6b829.9-10027231, mixed mode)

• Gradle: 8.5

0x01001 avatar May 16 '25 04:05 0x01001

This is due to https://docs.shorebird.dev/code-push/performance/. This type of failure is uncommon, but does happen. It happens when the Dart compiler decides to "optimize" a part of the patch in a different way than it did in the base and causes a ton of the patch to "unlink". If you're able to share your patch-debug.zip we're happy to take a look further!

eseidel avatar May 16 '25 14:05 eseidel

@eseidel Is the patch-debug.zip file safe to share publicly or should I send it to you via email?

0x01001 avatar May 16 '25 17:05 0x01001

Email is best. It contains class and function names from your source code which some people don't want to share. Thanks!

eseidel avatar May 16 '25 18:05 eseidel