-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizese: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for WebCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.perf: app sizePerformance issues related to app size (binary/code size) or disk spacePerformance issues related to app size (binary/code size) or disk spaceperf: startupPerformance issues related to app startup timePerformance issues related to app startup timeplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
Goals:
- Reduce CanvasKit bundle size by 140KB
- Make image decoding non-blocking on Firefox and Safari.
Background
Our current image codecs embedded into CanvasKit do the job, but our approach has a number of issues:
- According to my experiments image codecs add ~140KB to the compressed payload, which is significant.
- In browsers that support the
ImageDecoderAPI these codecs are not used, so all they do is contribute to payload sizes and poor start-up times. - Not all apps need to render an image on the very first frame, so loading image codecs before the first frame is sub-optimal.
- The codecs execute on the main UI thread, blocking frames, which leads to jank.
Proposal
- Remove image codecs from the main wasm bundle.
- Use
ImageDecoderfor all decoding needs, if available. - Use
<img>to decode static images in browsers that don't supportImageDecoder. Many, if not most, images are static (i.e. not animated).WebGLRenderingContext.texImage2DsupportsHTMLImageElementas the source. - Create a separate wasm bundle for image codecs for cases not covered by the above. Load the bundle on-demand, only when the app actually needs to decode an animated image.
Some hand-optimized applications can go even further and use the raw <img> tag in a platform view for animated images, removing the need for codecs even on browsers that don't have ImageDecoder.
xtyxtyx, hilongjw, cedvdb and iapicca
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizese: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for WebCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.perf: app sizePerformance issues related to app size (binary/code size) or disk spacePerformance issues related to app size (binary/code size) or disk spaceperf: startupPerformance issues related to app startup timePerformance issues related to app startup timeplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team