Release
App Performance

App Performance

SKSL Precaching:

SKSL (Skia Shader Language) is a shading language used by Skia, the graphics engine used by Flutter. Precaching SKSL can help improve the performance of your Flutter app by reducing the time it takes to compile shaders at runtime.

To precache SKSL, you can use the precache method of the ShaderWarmUp class provided by Flutter. The precache method takes a list of Shader objects and warms up the shaders by compiling them in advance.

How to use SkSL warmup

  1. Run the app with --cache-sksl turned on to capture shaders in SkSL:
flutter run --profile --cache-sksl --purge-persistent-cache
  1. Play with the app to trigger as many animations as needed; particularly those with compilation jank.

  2. Press M at the command line of flutter run to write the captured SkSL shaders into a file named something like flutter_01.sksl.json. For best results, capture SkSL shaders on an actual iOS device. A shader captured on a simulator isn’t likely to work correctly on actual hardware.

  3. Build the app with SkSL warm-up using the following, as appropriate:

flutter build ios --bundle-sksl-path flutter_01.sksl.json

If it’s built for a driver test like test_driver/app.dart, make sure to also specify --target=test_driver/app.dart (for example, flutter build ios --bundle-sksl-path flutter_01.sksl.json --target=test_driver/app.dart).