SlideShare a Scribd company logo
1 of 56
1
MIND YOUR APP FOOTPRINT! 🐾⚡🌱
How to Test & Reduce your Mobile App Footprint
#FlutterConnection23
Adrien BODY
Staff Engineer Jocelyn GRISELLE
Software Engineer
Contractor
François NOLLEN
Staff Engineer
Dev Rel
🧠 YOUR 📱 👣 !
3
• Why
• Product & design
• Developer techniques
•
🔎
Tree Shaking
•
🔎
Eco-friendly mode
•
🔎
Deferred Components
• Testing & Monitoring
•
🔎
Green Tools
•
🔎
Tests
• Conclusion
WHY
4
Digital technologies cause
2.5% Carbon footprint
4% GHG emissions
(sources: ADEME/ARCEP 2023
+ The Shift Project 2019)
5
Source : ADEME / ARCEP
(March 2023)
6
Source : ADEME / ARCEP
(March 2023)
7
Source : ADEME / ARCEP
(March 2023)
PRODUCT & DESIGN
Doing the right thing 🎁
8
9
• Good product value 🌱
• Useful features 💡
• Efficient design / UX 💚
• Accessibility 🛟
PRODUCT & DESIGN MATTER
MOBILE DEVELOPMENT
Doing the thing right ♻
10
11
FOOTPRINT
♻
🔋
💚
🌱
DEVICE
12
⚡ CPU usage / FPS
🪫 Consuming hardware
(camera, sensors, gps)
📡 Network (caches, offline mode)
🗜 Size (payloads, assets, storage)
💡 Most of those techniques are
very well-documented
BASICS
13
TLDR; « Everything is not Black & White » 😉
• LCD vs. AMOLED
• « Dark » mode or « black » mode?
DARK MODES
Greenspector results (testing our own app):
• Dark blue theme on AMOLED: 3.0 g CO2
• Light theme on AMOLED: 3.9 g CO2
• Dark blue theme on LCD: 3.9 g CO2
• Light theme on LCD: 3.9 g CO2
Per year estimation (all shopping on dark blue mode):
• 22.5 M transactions on LCD + 7 M on AMOLED
• = 7 T of CO2 would be saved each year
14
A good thread strategy on a
multi-core CPU:
• Saves battery 🔋
• Optimizes UX 💚
💡 Threads can be optimized to run on a
separate core if available, a small or big
core when it’s an heavy task.
THREADS MATTER
Photo:
https://unsplash.com/fr/photos/NLgqFA9Lg_E
15
EG. HOW WE USE THREADS
• Main thread for simple UI and logic
• Isolates/Computes for complexe tasks
• Eg. deserializing with Compute (F) or Isolate.run (D) big payloads
• Eg. multiple requests in // with Isolate
• scheduleMicrotask
• Eg. network call needed for screen, prior to any other async Future
• workmanager for background native tasks
• Eg. Acknowledge notification in background
(⚠ Remember that Compute has a little boot overhead time)
16
REPAINT BOUNDARIES
• Separate widgets to subtrees at rendering level,
helping Flutter renderer know when repaint is needed
• Can optimize screens with many interactions
Photo:
https://unsplash.com/fr/photos/lvhu6dlFyLs
17
• Upgrading libs and
frameworks ASAP
• Leveraging new features
and improvements
…Including
⚡
and
🗜
!
STAYING UP-TO-DATE
STAYING UP-TO-DATE 👉 EXAMPLE
18
Before ⏳
(Skia only)
After ⚡ (Impeller)
(Emmanuel Lefebvre)
@ Flutter Paris, Jan’23
MOVING LOGIC TO THE BACK-END
19
• Presentation logic moved serverside:
• Presentation model / mapping
• Formatting, Localization
• Etc.
ü Consistency over multiple channels 🔐
ü Less code, fast redeploy, better TTM 🚀
ü Smaller frontend app(s) & less crashes 🌱
BFF server
(Back-For-Front)
Other channels
(eg. chatbots)
Mobile
Web
RESULTS: PAYLOAD AND MORE
20
[Ranking] Total payload on the network during navigation (source: Greenspector)
EXAMPLE: TRACKING & CONSENTS
21
S2S
tracking
vendors
BFF server
(Back-For-Front)
Other channels
(eg. chatbots)
Mobile
Web
• Server-to-server
tracking & consents
(☝GDPR)
• Frontend instrumentation
without 3rd-party SDKs
(RouteObserver,
consents listener)
Less 3rd-party SDKs in your app:
• Less CPU, less storage ⚡🗜🙂🌱
• Less integration issues or crashes 💣
22
📦 App Bundles
🌴 Tree Shaking
OPTIMIZING BUNDLES
Photo:
https://unsplash.com/fr/photos/r2jpr8MDw0I
ANDROID APP BUNDLES
23
• Android App Bundles
• Optimized bundles
for different devices
• In our case (average):
📉 -48% weight
OPTIMIZED BUNDLES FOR IOS?
24
• iOS build optimizations? No big difference measured so far with Flutter
• With iOS 14, the bitcode option has disappeared 🙁
• (Apple anticipating new homogeneous architecture?)
Source: https://www.emergetools.com/blog/posts/how-xcode14-unintentionally-increases-app-size
25
TREE SHAKING 🌴
Removes unused:
• Functions
• Fields
• Types
• Type params
• Type args
• Metadata
• Lib entries
• Classes
• Libs
Photo:
https://unsplash.com/fr/photos/DNkoNXQti3c
« LET’S SHAKE THE FLUTTER TREE »
26
Let’s Shake the Flutter Tree
(Aleksander Denisov)
@ Flutter Heroes ’23
TREE SHAKING IN PRACTICE
27
Use const at compile time (or conditional imports for Web)
1
VS.
2
28
• ⚠ Workspace: incorrect Android or Gradle files locations and non-necessary files get included into the bundle
• ⏳ Assets: not tree-shaked by default #64106
• ⏳ Conditional Imports: available only for the Web #23122
29
♻ Saving-energy mode
🪫 Low battery detected
🦕 Old device / low-end
device detected
CUSTOM ECO-MODE
30
🧑💻 UI thread &📱 Platform thread:
• More cache / longer TTL
• Disable secondary SDKs
• Avoid / Reduce precision
on geolocation
WHAT TO DISABLE / ADJUST
⚡ Raster thread:
• Disable transition animations
• Disable blend effects, opacity
• Disable clips, shadows
EXAMPLE
31
🤔 Disabling things from our onboarding wizard…
On a low-end device (2018):
- UX slightly degraded
ü FPS: +60 fps
ü CPU usage (average): 79% à 36%
👉 All about choices and balance
💚 No hardcore dev skills required
32
(and Dynamic Features)
DEFERRED COMPONENTS
Photo:
https://unsplash.com/fr/photos/gdL-UZfnD3I
EXAMPLE
33
💡 Defer the IDFM support in app?
• Public transportation for Paris only
• Buy dematerialized metro tickets
• Use your phone as a ticket
34
(Warning: a single missing import leads to no deferred lib)
1
2
DEFERRED COMPONENTS IN PRACTICE
DEFERRED COMPONENTS IN PRACTICE
35
pubspec.yaml
3
<meta-data
android:name="flu2erEmbedding"
android:value="2"/>
<meta-data
android:name="io.flu2er.embedding.engine.deferredcomponents.DeferredCom
ponentManager.loadingUnitMapping" android:value="2:idfm_sdk"/>
android:name="io.flu2er.embedding.android.Flu2erPlaySto
reSplitApplicaKon" Flu2erPlayStoreSplitApplicaKon()
or
4 5
36
37
BUILDING AND DEPLOYING
38
Photo:
https://unsplash.com/fr/photos/IEiAmhXehwE
39
HOW WE DEVELOP
MATTERS TOO
🧑💻 Work stations
(how many monitors do you use?... 🖥💻🖥)
🏭 Running environments, infrastructure,
integration pipelines, deployments…
40
⏳ Long-lived feature branches, running
envs/code waiting, the « 7 wastes of Lean »…
(prefer small increments & CD)
🚥 Backwards compatibility
(supporting old devices
👉
dedicated
tests/running environments?)
HOW WE DEVELOP
MATTERS TOO
TESTING & MONITORING ♻
41
GREENSPECTOR
42
(July 2022)
USER SCENARIO RANKING
85
Performance
(Elapsed Time)
117.5 s
Mobile Data
1.1 Mo
90
Energy
112.8 mAh
50
43
(Source: Greenspector 2022)
44
> MORE TOOLS
MONITORING TOOLS (EXAMPLES)
45
Sentry
ü « User Misery » Tools & Suspects
Datadog
ü CPU Usage
ü Memory Usage
ü FPS
Firebase
ü HTTP Latencies
ü App Start Time
46
> maestro test ./test_e2e/onboarding.yml
• Easy to write / run flows
• Based on real use cases
• Sometimes a bit flaky…
MAESTRO
FLASHLIGHT
47
• Performance stats
• Combines with your e2e tests nicely
• Can run/integrate with CI
• Iterations and retries
• Easy to compare runs
• (Only for Android)
48
INTEGRATION TESTS
CHROME TRACING / PERFETTO
49
GOLDEN TESTS FOR A11Y AND OLD DEVICES
50
ASSESSMENT MODELS
51
👉 https://ecoresponsable.numerique.gouv.fr
/publications/referentiel-general-ecoconception/
👉 https://myecodesignmaturity.eu/en.html
MESURE AND COMPARE 🌱 PERFORMANCE
52
Each feature
At least regularly
Many tools
available!
Monitoring
Tools
🌱 Crash
Analytics
Tools
Flutter
Debug Tools
Integ. Tests
+ Dedicated
Tools
Eco
Specialized
Tools
Assessment
Models
Golden
Tests
CONCLUSION
53
TAKEAWAYS
54
RESOURCES WE’VE SHARED (🇫🇷 / 🇬🇧)
55
E2E Testing with Flutter
Widget Testing with Flutter
Accessibility Testing with Flutter
Flutter @ Devoxx France
Flutter Heroes 2023
https://jobs.connect-tech.sncf/

More Related Content

What's hot

Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsSpark Summit
 
Introduction à ElasticSearch
Introduction à ElasticSearchIntroduction à ElasticSearch
Introduction à ElasticSearchFadel Chafai
 
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)De component à feature team (Rex STIME DSI Groupement des Mousquetaires)
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)Agile En Seine
 
Agile software development
Agile software developmentAgile software development
Agile software developmentRajesh Piryani
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoinWilliam Chong
 
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...Manuel Pais
 
GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done rightChen Cheng-Wei
 
Introduction to Agile Software Development
Introduction to Agile Software DevelopmentIntroduction to Agile Software Development
Introduction to Agile Software DevelopmentLife Cycle Engineering
 
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...Matthew Skelton
 
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...Spark Summit
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkPatrick Wendell
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache SparkRahul Jain
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the BasicsUlrich Krause
 
Introduction à Scrum et aux méthodes agiles (v1.0)
Introduction à Scrum et aux méthodes agiles (v1.0)Introduction à Scrum et aux méthodes agiles (v1.0)
Introduction à Scrum et aux méthodes agiles (v1.0)Blackbird
 
Spark overview
Spark overviewSpark overview
Spark overviewLisa Hua
 

What's hot (20)

Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
Introduction à ElasticSearch
Introduction à ElasticSearchIntroduction à ElasticSearch
Introduction à ElasticSearch
 
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)De component à feature team (Rex STIME DSI Groupement des Mousquetaires)
De component à feature team (Rex STIME DSI Groupement des Mousquetaires)
 
Agile software development
Agile software developmentAgile software development
Agile software development
 
Cloud Native: what is it? Why?
Cloud Native: what is it? Why?Cloud Native: what is it? Why?
Cloud Native: what is it? Why?
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
 
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...
Fast Flow & Organizational Evolution with Team Topologies @ Masters of Softwa...
 
GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done right
 
Introduction to Agile Software Development
Introduction to Agile Software DevelopmentIntroduction to Agile Software Development
Introduction to Agile Software Development
 
Github copilot
Github copilotGithub copilot
Github copilot
 
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...
Beyond the Spotify model - Team Topologies - DevTestNorth - 2019-09-25 - Matt...
 
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...
How to Share State Across Multiple Apache Spark Jobs using Apache Ignite with...
 
Agile
AgileAgile
Agile
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache Spark
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache Spark
 
Methodes agile
Methodes agileMethodes agile
Methodes agile
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics
 
Introduction à Scrum et aux méthodes agiles (v1.0)
Introduction à Scrum et aux méthodes agiles (v1.0)Introduction à Scrum et aux méthodes agiles (v1.0)
Introduction à Scrum et aux méthodes agiles (v1.0)
 
Spark overview
Spark overviewSpark overview
Spark overview
 
CI/CD with GitHub Actions
CI/CD with GitHub ActionsCI/CD with GitHub Actions
CI/CD with GitHub Actions
 

Similar to Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)

Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)
Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)
Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)François
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Fabrice Bernhard
 
Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Fwdays
 
Android Performance Tips & Tricks
Android Performance Tips & TricksAndroid Performance Tips & Tricks
Android Performance Tips & TricksSergii Zhuk
 
Batty consumerization of geospatial
Batty consumerization of geospatialBatty consumerization of geospatial
Batty consumerization of geospatialGeCo in the Rockies
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in AndroidJuan Camilo Sacanamboy
 
Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Opersys inc.
 
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)François
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.UA Mobile
 
Extending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteExtending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteOpersys inc.
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceIntel® Software
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIOpersys inc.
 
Keeping IoT stack in quality check - meetup IoT Under Test
Keeping IoT stack in quality check  - meetup IoT Under TestKeeping IoT stack in quality check  - meetup IoT Under Test
Keeping IoT stack in quality check - meetup IoT Under TestSilvair
 
Profiling Android Applications
Profiling Android ApplicationsProfiling Android Applications
Profiling Android Applicationshubx
 
Embedded Android Workshop at AnDevCon VI
Embedded Android Workshop at AnDevCon VIEmbedded Android Workshop at AnDevCon VI
Embedded Android Workshop at AnDevCon VIOpersys inc.
 
Is Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VIs Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VOpersys inc.
 
Droidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensicsDroidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensicsviaForensics
 
Community works for muli core embedded image processing
Community works for muli core embedded image processingCommunity works for muli core embedded image processing
Community works for muli core embedded image processingJeongpyo Kong
 
Embedded Android Workshop at Embedded World 2014
Embedded Android Workshop at Embedded World 2014Embedded Android Workshop at Embedded World 2014
Embedded Android Workshop at Embedded World 2014Opersys inc.
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better PerformanceElif Boncuk
 

Similar to Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023) (20)

Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)
Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)
Mind your App Footprint 🐾⚡️🌱 (@FlutterHeroes 2024)
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
 
Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"
 
Android Performance Tips & Tricks
Android Performance Tips & TricksAndroid Performance Tips & Tricks
Android Performance Tips & Tricks
 
Batty consumerization of geospatial
Batty consumerization of geospatialBatty consumerization of geospatial
Batty consumerization of geospatial
 
Keep calm and write reusable code in Android
Keep calm and write reusable code in AndroidKeep calm and write reusable code in Android
Keep calm and write reusable code in Android
 
Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014
 
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)
The Story of SNCF Connect - biggest Flutter app in Europe (@FlutterHeroes 2023)
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
 
Extending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteExtending Android's Platform Toolsuite
Extending Android's Platform Toolsuite
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript Performance
 
Is Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VIIs Android the New Embedded Linux? at AnDevCon VI
Is Android the New Embedded Linux? at AnDevCon VI
 
Keeping IoT stack in quality check - meetup IoT Under Test
Keeping IoT stack in quality check  - meetup IoT Under TestKeeping IoT stack in quality check  - meetup IoT Under Test
Keeping IoT stack in quality check - meetup IoT Under Test
 
Profiling Android Applications
Profiling Android ApplicationsProfiling Android Applications
Profiling Android Applications
 
Embedded Android Workshop at AnDevCon VI
Embedded Android Workshop at AnDevCon VIEmbedded Android Workshop at AnDevCon VI
Embedded Android Workshop at AnDevCon VI
 
Is Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon VIs Android the New Embedded Linux? at AnDevCon V
Is Android the New Embedded Linux? at AnDevCon V
 
Droidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensicsDroidcon it-2014-marco-grassi-viaforensics
Droidcon it-2014-marco-grassi-viaforensics
 
Community works for muli core embedded image processing
Community works for muli core embedded image processingCommunity works for muli core embedded image processing
Community works for muli core embedded image processing
 
Embedded Android Workshop at Embedded World 2014
Embedded Android Workshop at Embedded World 2014Embedded Android Workshop at Embedded World 2014
Embedded Android Workshop at Embedded World 2014
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better Performance
 

More from François

C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)François
 
Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)François
 
REX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfREX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfFrançois
 
OpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsOpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsFrançois
 
Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020François
 
Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19François
 
TOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportTOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportFrançois
 
Monitoring une recette DevOps
Monitoring une recette DevOpsMonitoring une recette DevOps
Monitoring une recette DevOpsFrançois
 
DevOps et tendances Monitoring
DevOps et tendances MonitoringDevOps et tendances Monitoring
DevOps et tendances MonitoringFrançois
 

More from François (9)

C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
C'est une bonne situation ça, Staff Engineer ? 😉 (@DevoxxFR 2024)
 
Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)Monorepo & Monomythe (@Volcamp 2023)
Monorepo & Monomythe (@Volcamp 2023)
 
REX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdfREX Flutter SNCF Connect (@VivaTech 2022).pdf
REX Flutter SNCF Connect (@VivaTech 2022).pdf
 
OpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développementsOpenSource & InnerSource pour accélérer les développements
OpenSource & InnerSource pour accélérer les développements
 
Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020Tock & Mélusine REX IA Open Source #AIParis 2020
Tock & Mélusine REX IA Open Source #AIParis 2020
 
Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19Conversational AI & Open Source #OSSPARIS19
Conversational AI & Open Source #OSSPARIS19
 
TOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open TransportTOCK (The Open Conversation Kit) @ Meetup Open Transport
TOCK (The Open Conversation Kit) @ Meetup Open Transport
 
Monitoring une recette DevOps
Monitoring une recette DevOpsMonitoring une recette DevOps
Monitoring une recette DevOps
 
DevOps et tendances Monitoring
DevOps et tendances MonitoringDevOps et tendances Monitoring
DevOps et tendances Monitoring
 

Recently uploaded

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Mind your App Footprint 🐾⚡️🌱 (@FlutterConn 2023)

  • 1. 1 MIND YOUR APP FOOTPRINT! 🐾⚡🌱 How to Test & Reduce your Mobile App Footprint #FlutterConnection23
  • 2. Adrien BODY Staff Engineer Jocelyn GRISELLE Software Engineer Contractor François NOLLEN Staff Engineer Dev Rel
  • 3. 🧠 YOUR 📱 👣 ! 3 • Why • Product & design • Developer techniques • 🔎 Tree Shaking • 🔎 Eco-friendly mode • 🔎 Deferred Components • Testing & Monitoring • 🔎 Green Tools • 🔎 Tests • Conclusion
  • 4. WHY 4 Digital technologies cause 2.5% Carbon footprint 4% GHG emissions (sources: ADEME/ARCEP 2023 + The Shift Project 2019)
  • 5. 5 Source : ADEME / ARCEP (March 2023)
  • 6. 6 Source : ADEME / ARCEP (March 2023)
  • 7. 7 Source : ADEME / ARCEP (March 2023)
  • 8. PRODUCT & DESIGN Doing the right thing 🎁 8
  • 9. 9 • Good product value 🌱 • Useful features 💡 • Efficient design / UX 💚 • Accessibility 🛟 PRODUCT & DESIGN MATTER
  • 10. MOBILE DEVELOPMENT Doing the thing right ♻ 10
  • 12. 12 ⚡ CPU usage / FPS 🪫 Consuming hardware (camera, sensors, gps) 📡 Network (caches, offline mode) 🗜 Size (payloads, assets, storage) 💡 Most of those techniques are very well-documented BASICS
  • 13. 13 TLDR; « Everything is not Black & White » 😉 • LCD vs. AMOLED • « Dark » mode or « black » mode? DARK MODES Greenspector results (testing our own app): • Dark blue theme on AMOLED: 3.0 g CO2 • Light theme on AMOLED: 3.9 g CO2 • Dark blue theme on LCD: 3.9 g CO2 • Light theme on LCD: 3.9 g CO2 Per year estimation (all shopping on dark blue mode): • 22.5 M transactions on LCD + 7 M on AMOLED • = 7 T of CO2 would be saved each year
  • 14. 14 A good thread strategy on a multi-core CPU: • Saves battery 🔋 • Optimizes UX 💚 💡 Threads can be optimized to run on a separate core if available, a small or big core when it’s an heavy task. THREADS MATTER Photo: https://unsplash.com/fr/photos/NLgqFA9Lg_E
  • 15. 15 EG. HOW WE USE THREADS • Main thread for simple UI and logic • Isolates/Computes for complexe tasks • Eg. deserializing with Compute (F) or Isolate.run (D) big payloads • Eg. multiple requests in // with Isolate • scheduleMicrotask • Eg. network call needed for screen, prior to any other async Future • workmanager for background native tasks • Eg. Acknowledge notification in background (⚠ Remember that Compute has a little boot overhead time)
  • 16. 16 REPAINT BOUNDARIES • Separate widgets to subtrees at rendering level, helping Flutter renderer know when repaint is needed • Can optimize screens with many interactions Photo: https://unsplash.com/fr/photos/lvhu6dlFyLs
  • 17. 17 • Upgrading libs and frameworks ASAP • Leveraging new features and improvements …Including ⚡ and 🗜 ! STAYING UP-TO-DATE
  • 18. STAYING UP-TO-DATE 👉 EXAMPLE 18 Before ⏳ (Skia only) After ⚡ (Impeller) (Emmanuel Lefebvre) @ Flutter Paris, Jan’23
  • 19. MOVING LOGIC TO THE BACK-END 19 • Presentation logic moved serverside: • Presentation model / mapping • Formatting, Localization • Etc. ü Consistency over multiple channels 🔐 ü Less code, fast redeploy, better TTM 🚀 ü Smaller frontend app(s) & less crashes 🌱 BFF server (Back-For-Front) Other channels (eg. chatbots) Mobile Web
  • 20. RESULTS: PAYLOAD AND MORE 20 [Ranking] Total payload on the network during navigation (source: Greenspector)
  • 21. EXAMPLE: TRACKING & CONSENTS 21 S2S tracking vendors BFF server (Back-For-Front) Other channels (eg. chatbots) Mobile Web • Server-to-server tracking & consents (☝GDPR) • Frontend instrumentation without 3rd-party SDKs (RouteObserver, consents listener) Less 3rd-party SDKs in your app: • Less CPU, less storage ⚡🗜🙂🌱 • Less integration issues or crashes 💣
  • 22. 22 📦 App Bundles 🌴 Tree Shaking OPTIMIZING BUNDLES Photo: https://unsplash.com/fr/photos/r2jpr8MDw0I
  • 23. ANDROID APP BUNDLES 23 • Android App Bundles • Optimized bundles for different devices • In our case (average): 📉 -48% weight
  • 24. OPTIMIZED BUNDLES FOR IOS? 24 • iOS build optimizations? No big difference measured so far with Flutter • With iOS 14, the bitcode option has disappeared 🙁 • (Apple anticipating new homogeneous architecture?) Source: https://www.emergetools.com/blog/posts/how-xcode14-unintentionally-increases-app-size
  • 25. 25 TREE SHAKING 🌴 Removes unused: • Functions • Fields • Types • Type params • Type args • Metadata • Lib entries • Classes • Libs Photo: https://unsplash.com/fr/photos/DNkoNXQti3c
  • 26. « LET’S SHAKE THE FLUTTER TREE » 26 Let’s Shake the Flutter Tree (Aleksander Denisov) @ Flutter Heroes ’23
  • 27. TREE SHAKING IN PRACTICE 27 Use const at compile time (or conditional imports for Web) 1 VS. 2
  • 28. 28 • ⚠ Workspace: incorrect Android or Gradle files locations and non-necessary files get included into the bundle • ⏳ Assets: not tree-shaked by default #64106 • ⏳ Conditional Imports: available only for the Web #23122
  • 29. 29 ♻ Saving-energy mode 🪫 Low battery detected 🦕 Old device / low-end device detected CUSTOM ECO-MODE
  • 30. 30 🧑💻 UI thread &📱 Platform thread: • More cache / longer TTL • Disable secondary SDKs • Avoid / Reduce precision on geolocation WHAT TO DISABLE / ADJUST ⚡ Raster thread: • Disable transition animations • Disable blend effects, opacity • Disable clips, shadows
  • 31. EXAMPLE 31 🤔 Disabling things from our onboarding wizard… On a low-end device (2018): - UX slightly degraded ü FPS: +60 fps ü CPU usage (average): 79% à 36% 👉 All about choices and balance 💚 No hardcore dev skills required
  • 32. 32 (and Dynamic Features) DEFERRED COMPONENTS Photo: https://unsplash.com/fr/photos/gdL-UZfnD3I
  • 33. EXAMPLE 33 💡 Defer the IDFM support in app? • Public transportation for Paris only • Buy dematerialized metro tickets • Use your phone as a ticket
  • 34. 34 (Warning: a single missing import leads to no deferred lib) 1 2 DEFERRED COMPONENTS IN PRACTICE
  • 35. DEFERRED COMPONENTS IN PRACTICE 35 pubspec.yaml 3 <meta-data android:name="flu2erEmbedding" android:value="2"/> <meta-data android:name="io.flu2er.embedding.engine.deferredcomponents.DeferredCom ponentManager.loadingUnitMapping" android:value="2:idfm_sdk"/> android:name="io.flu2er.embedding.android.Flu2erPlaySto reSplitApplicaKon" Flu2erPlayStoreSplitApplicaKon() or 4 5
  • 36. 36
  • 37. 37
  • 39. 39 HOW WE DEVELOP MATTERS TOO 🧑💻 Work stations (how many monitors do you use?... 🖥💻🖥) 🏭 Running environments, infrastructure, integration pipelines, deployments…
  • 40. 40 ⏳ Long-lived feature branches, running envs/code waiting, the « 7 wastes of Lean »… (prefer small increments & CD) 🚥 Backwards compatibility (supporting old devices 👉 dedicated tests/running environments?) HOW WE DEVELOP MATTERS TOO
  • 43. USER SCENARIO RANKING 85 Performance (Elapsed Time) 117.5 s Mobile Data 1.1 Mo 90 Energy 112.8 mAh 50 43 (Source: Greenspector 2022)
  • 45. MONITORING TOOLS (EXAMPLES) 45 Sentry ü « User Misery » Tools & Suspects Datadog ü CPU Usage ü Memory Usage ü FPS Firebase ü HTTP Latencies ü App Start Time
  • 46. 46 > maestro test ./test_e2e/onboarding.yml • Easy to write / run flows • Based on real use cases • Sometimes a bit flaky… MAESTRO
  • 47. FLASHLIGHT 47 • Performance stats • Combines with your e2e tests nicely • Can run/integrate with CI • Iterations and retries • Easy to compare runs • (Only for Android)
  • 49. CHROME TRACING / PERFETTO 49
  • 50. GOLDEN TESTS FOR A11Y AND OLD DEVICES 50
  • 52. MESURE AND COMPARE 🌱 PERFORMANCE 52 Each feature At least regularly Many tools available! Monitoring Tools 🌱 Crash Analytics Tools Flutter Debug Tools Integ. Tests + Dedicated Tools Eco Specialized Tools Assessment Models Golden Tests
  • 55. RESOURCES WE’VE SHARED (🇫🇷 / 🇬🇧) 55 E2E Testing with Flutter Widget Testing with Flutter Accessibility Testing with Flutter Flutter @ Devoxx France Flutter Heroes 2023