Yuqian Li

By Yuqian Li and Shams Zakhour

Being fast is a key pillar to Flutter. This article highlights performance improvements from the first half of 2020 implemented by folks from the Flutter community.

If you’ve helped out with performance after June 2020, we will cover that in a future post. We hope that sharing this with you, the Flutter community, inspires you to help us with this effort!

[app size] 18.5% reduction in Flutter Gallery app size

contributors: alexmarkov, sstrickl, mkustermann, askeksa-google, rmacnak-google, mraleph, crelier

[app size] 100KB size reduction for Gallery app by font subsetting

contributors: dnfield, jonahwilliams, zanderso, jmagman, blasten

  • PR #14828, #49737, #49842, #50224, #51808
  • 100kb size reduction in Flutter Gallery app
  • Fixed “Tree shake material icons #16311”, “Build hb-subset as part of engine builds and upload to cloud storage #43642”, “Consume font-subset in flutter_tools and treeshake icon fonts #43644”, “Wire up font subsetting for all platforms #49730

[speed, memory] 9x speedup and 99 % memory reduction on dart2js tools

contributors: rmacnak-google, a-siva

[speed] Up to 50% speedup for iOS average render speed by moving from OpenGL to Metal

contributors: chinmaygarde, dnfield, jason-simmons, cbracken, amirh, liyuqian

[speed] 2–5x speedup for the worst frame raster time caused by shader compilations

contributors: liyuqian, jonahwilliams, chinmaygarde, iskakaushik, zanderso, sfshaza2, filiph, acoutts

Image for post

Image for post

[speed] 15.8x speedup for mouse hit testing

contributors: dkwingsmt, yjbanov, goderbauer, gspencergoog

  • PR #59803 #59883
  • 15.8x (79ms to 5ms) speedup for bench_mouse_region_grid_scroll frame duration (web).
  • Fixed “Poor performance when subscribing to MouseRegion events #41194

[speed] 13.9x speedup for platform message response handling

contributors: zljj0818, jason-simmons, liyuqian

  • PR #18838, #18945, both of which are inspired by #18808
  • Fixed “Image.asset will block UI thread when load large image #58572
  • 13.9x (9164us to 660us) speedup in PlatformMessageResponseDartComplete

[speed] 20%-37% speedup for frame build time with opaque routes

contributors: goderbauer, dnfield

  • PR #48900
  • 20% (7.38ms to 6.13ms) speedup in flutter_gallery_ios32__transition_perf average_frame_build_time_millis
  • 37% (50.45ms to 36.63ms) speedup in flutter_gallery_ios32__transition_perf 99th_percentile_frame_build_time_millis
  • Fixed “Optimize unneeded rebuild when pushing overlay/navigator opaque content #45797

[speed] 4.8x speedup for blur using ImageFiltered instead of BackdropFilter

contributors: flar, hixie, yjbanov, liyuqian

[speed] Up to 14x speedup when scrolling large static content with Flutter web

contributors: yjbanov, ferhatb

  • PR #17621
  • 14.01x speedup (463.74ms to 33.10ms) for text_canvas_cached_layout.html.layout.average
  • Fixed “Jank when scrolling large static content with Flutter Web #42987” and “Drawing text outside canvas’ bounds is expensive on the Web #48516

[speed] 6.8x speedup for Flutter engine shell initialization

contributors: scutlight, jason-simmons, gaaclarke, liyuqian

[speed] 5x speedup by skipping calling builder when constraints are the same

contributors: yjbanov, hixie

  • PR #55414
  • 5x speedup (~10FPS to ~50FPS) on scrolling the contacts list with the Flokk customer app.
  • Fixed “LayoutBuilder should cache constraints and not rebuild if unchanged #6469

[speed] 2x speedup for shadows and animation on web

contributors: ferhatb, mdebbar, yjbanov

[speed] 3X speedup in web Flutter Gallery start-up

contributors: ferhatb, clocksmith, rami-a

[speed] 2.8x speedup for average frame rasterizer time by enabling raster cache in Fuchsia

contributors: dreveman, liyuqian, chinmaygarde, arbreng

  • PR #17753
  • 2.8x speedup (~10ms to ~3.5ms) for frame_rasterizer_times_avg
  • Fixed “Poor performance on Fuchsia due to raster cache being disabled #54950

[speed] 1.85x speedup in 90th percentile frame build time by excluding invisible animated images

contributors: dnfield, liyuqian, tvolkert, digiter

  • PR #50851, #50842
  • 1.85x speedup (3.148 ms to 1.699 ms) for animated_placeholder_perf 90th percentile frame build time
  • Fixed “flutter gives low frame rates when long lists with list builder inside cards giving(avg 20–35fps) #35592

[speed] 2x speedup for Google smart displays P10 FPS

contributors: chinmaygarde, dnicoara, cbracken, jason-simmons, asakhart, rdaum

  • PR #15980
  • 2x speedup (30fps to 60fps) by giving embedders a way to tune thread priority.
  • Fixed issue 49551

[speed] 2.45x speedup for ImageFilterLayer by enhancing its child cache

contributors: flar, liyuqian

  • PR #17175, #54903, #58277
  • 2.45x speedup (18.41 ms to 7.53 ms) for ImageFiltered Transform average_frame_rasterizer_time_millis
  • Also fixed “Transition performance regressed slightly due to OpacityLayer raster cache miss #52864

[speed] 15% speedup for very large dart2js compilation

contributors: rmacnak-google, a-siva

[speed] 1.8x speedup in AOT compilation time of a large app

contributors: alexmarkov, mraleph, sigurdm, cskau-g

  • Commit 467c98
  • 1.8x speedup (274s to 152s) in AOT compilation time of a large app ( — from-dill)

[speed] 5x-13x speedup on Dart RegExp matching in AOT mode

contributors: mraleph, rmacnak-google

[speed] Up to 5x speedup in Dart UTF8 decoding

contributors: askeksa-google, mkustermann, rakudrama

[speed] 35–65% speedup in async/sync* functions

contributors: cskau-g, mkustermann, mraleph

  • Commit e29407, fdca1f, 7ed169, ca94ad
  • 35–65% speedup in Calls.IterableManualIterablePolymorphicManyYields across {dart,dart-aot}-{ia32,x64,armv7hf,armv8}
  • Fixed “improve performance of sync* code on VM #37753”, “Evaluate use of IndirectGoto when generating sync-yield function in VM #37754

[speed] Up to 31.82% reduction in time with unboxed parameters and fields

contributors: mkustermann, mkustermann

[speed] 20–25% speedup on Dart Pointer loads/stores in AOT

contributors: dcharkes, mkustermann

  • Commit 408123
  • Speeds up Pointer loads/stores by 20–25% in AOT on x64.
  • Helped “stores and loads should support unboxed indices (in AOT) #39432

[app size, energy, memory, speed] Add A/B test mode to local devicelab runner

contributors: yjbanov, flar, ferhatb, christopherfujino, liyuqian

[app size] Fixed “iOS App Size in FAQ incorrect”

contributors: jmagman, xster, dnfield, sfshaza2

[app size] Enable the usage of — delete-tostring-package-uri in the flutter too

contributors: jonahwilliams, dnfield

[energy, memory] Timeline summary now includes CPU/GPU/memory for iOS

contributors: iskakaushik, gaaclarke, albertwang0116, liyuqian, chinmaygarde, gw280

[memory] ImageCache flushes itself when told about memory pressure

contributors: dnfield, goderbauer, chunhtai

[memory] Fixed “Skia PathMask cache leaks memory”

contributors: bsalomon

[memory] Fixed firebase_ml_vision memory leak on iOS

contributors: rishabnayak, bparrishmines

[memory] Added DevTools based max memory test

contributors: liyuqian, dnfield, digiter

[memory] Defer image decoding when scrolling fast

contributors: dnfield, hixie, goderbauer

[memory] If an image is available in the tree currently, it should be resolvable by key without reloading even if it didn’t fit into the image cache

contributors: dnfield, hixie, goderbauer, jonahwilliams, ignatz, gaaclarke

[speed] Rewrite DevTools frame chart with parallel UI and raster thread times

contributors: kenzieschmoll, terrylucas

[speed] Added new Gallery mobile benchmarks

contributors: guidezpl, liyuqian, clocksmith, rami-a, flar

[speed] Add new Gallery web benchmarks

contributors: pennzht, yjbanov, guidezpl, willlarche, clocksmith, josealba

[speed] Community added a new package to unlock 90 fps for some devices

contributors: ajinasokan

[speed] Renamed GPU thread to raster thread

contributors: filiph, liyuqian, kenzieschmoll, chinmaygarde, cbracken, goderbauer, zanderso, devoncarew, sfshaza2

[speed] Added benchmark for platform views

contributors: blasten, cyanglaz

[speed] Avoid unnecessary thread clock clock calls while tracing, resulting in less (kernel) trace buffer space usage, and slightly lower tracing overhead.

contributors: nathanrogersgoogle, a-siva, fmeawad, johngro

[speed] Fix RefreshIndicator performance issue

contributors: dnfield, goderbauer

[speed] Enable lazy async stack traces via tool feature

contributors: jonahwilliams, zanderso

[speed] [flutter_tools] initialize frontend server with build

contributors: jonahwilliams, zanderso

[speed] Colored box and container optimization

contributors: dnfield, hansmuller, piinks, redbrogdon, goderbauer, liyuqian

Due to the lowered productivity as a result of COVID-19, we expected to have fewer performance improvements. Surprisingly, we found more quantified improvements in Q1-Q2 2020 than Q3-Q4 2019 (25 vs. 20) thanks to our growing community! Overall, we see 49 improvements from 78 contributors in Q1-Q2 2020.

Despite our best effort, some performance contributions in Q1-Q2 2020 may be missed in this update. Please don’t hesitate to let us know of any missing contributions, and we’ll put them in the next update.