SlideShare a Scribd company logo
1 of 52
Download to read offline
Cross-Platform
Mobile UI
“Compilers, Compilers Everywhere”
27 June 2023 – EOSS Prague
Andy Wingo
Igalia, S.L.
Apps apps
apps
This is a talk about apps; good apps
And compilers; weird compilers
And open source, cross-platform app
frameworks
And the unexpected end of the end of
history
Do we know
how to
make apps?
SwiftUI
❧
React Native
❧
Java and Android views
❧
Jetpack Compose
❧
OpenGL / Vulkan
❧
AppKit
❧
Capacitor
❧
NativeScript
❧
Flutter
❧
UIKit
❧
Step back I.M.H.O.—H before the O
Observe and learn: look for meaning
and motivation
Come back with lessons, then apply
them to now
Lessons 1.
2.
3.
4.
5.
Lesson 1 The old thing: stateful widget trees
var count = 0
let stack = new VStack
let text = new Text("Count: (count)")
stack.add_child(text)
let button = new Button("Increment")
button.set_onclick(||
count += 1
text.set_text("Count: (count)")
)
stack.add_child(button)
https://raphlinus.github.io/ui/
druid/2019/11/22/reactive-ui.html
Lesson 1:
Declarative
UI won on
the web
The newer thing: Declarative UI
2013: React
function Hello({ name }) {
return (
<p>Hello from React, {name}!</p>
);
}
UI is a function: translate state to
immutable tree of elements
Nowadays many derivatives of this
paradigm
Lesson 1:
Declarative
UI won on
Android
2019: Jetpack Compose
@Composable
fun MessageCard(name: String) {
Text(text = "Hello from " +
"Jetpack Compose, $name!");
}
Sometimes UI tree implicitly collected
instead of returned
Lesson 1:
Declarative
UI won on
iOS
2019: SwiftUI
struct ContentView: view {
var name: String
var body: some View {
Text("Hello from SwiftUI, (name)!")
.padding()
}
}
Particularly lovely ergonomics
Lesson 1:
Declarative
UI won,
cross-
platform
2017: Flutter
class Hello extends StatelessWidget {
const Hello({required this.name,
super.key});
final String name;
@override
Widget build(BuildContext context) {
return Text('Hello from Flutter,'
+ '$name!');
}
}
Even when people abstract away from
platform, they go declarative
Lesson 1:
Declarative
UI won
But why? 3 reasons
Managers like it: Decompose UI
into org chart (Conway’s law)
❧
Comprehensively avoid view/model
state mismatch
❧
Developers seem to like it too
❧
Lessons 1. Declarative UI won
2.
3.
4.
5.
Lesson 2 The rise of the framework
Developer declares UI
❧
Framework translates to imperative
operations on e.g. GPU
❧
Framework determines when UI
needs recomputation
❧
Observation: UI tree computation O(n)
in UI size
How to avoid performance disaster?
Lesson 2:
Frameworks
limit
performance
Division of labor: app developers say
what, framework developers say how
Risky bargain
4 main techniques
Managed state
❧
Incremental render
❧
Concurrent render
❧
Concurrent GC
❧
Lesson 2:
Frameworks
limit
performance
Technique 1: Managed state
Framework re-renders only when
needed
function Hello({ name }) {
const [count, setCount] = useState(0);
function inc() {
setCount(x => x+1);
}
return (
<div>
<p>Count: {count}</p>
<button onclick={inc}>+1</button>
</div>
);
}
Lesson 2:
Frameworks
limit
performance
Technique 2: Incremental render
Functional on top, but always
imperative underneath
Web: DOM
❧
React Native: UIKit / Android view
tree
❧
Flutter: GPU pipeline objects
❧
Don’t recreate whole DOM on each
frame: just apply changes
Pixels[N+1] := Pixels[N] +
Diff(UI[N+1], UI[N])
Lesson 2:
Frameworks
limit
performance
Technique 3: Concurrent render
Basic: Build UI on one thread, render
to GPU/DOM on another
Hard on the web, easier on mobile
Limited gains for per-frame
concurrency
Lesson 2:
Frameworks
limit
performance
Technique 4: Concurrent GC
Concurrent: Runs while program runs.
Move O(n) trace off main thread
Without concurrent GC:
// UI thread
frame . frame . frame . pause: trace+finish . frame
With concurrent GC:
// UI thread
frame . frame . frame . pause: finish . frame
// GC thread
trace.................
Reduce long-pole GC pause
Lesson 2:
Frameworks
limit
performance
Providing good performance is a
framework concern
Frameworks nudge app developers
into good performance patterns
Frameworks limit performance too
Lessons 1. Declarative UI won
2. Frameworks limit performance
3.
4.
5.
Lesson 3
Lesson 3:
Compilers
are back
Example 1: Front-end
@Composable
fun MessageCard(name: String) {
Text(text = "Hello from " +
"Jetpack Compose, $name!");
}
@Composable decorator: make it look
like you declare a tree, but compile to
imperative operations
Lesson 3:
Compilers
are back
Not just Jetpack Compose
SwiftUI ResultBuilder
❧
HarmonyOS ArkUI with “eTS”
❧
React JSX
❧
Compilers are a core part of the
modern UI story
To work in this space: control the
means of production
Lesson 3:
Compilers
are back
Example 2: Deployment
Problem: Minimize startup latency,
maximize runtime predictability
Trend: Move to ahead-of-time
compilation
React Native Hermes
❧
Panda ArkTS (without eval!)
❧
Dart AOT
❧
Predictability over performance
Lesson 3:
Compilers
are back
Example 3: Graphics
Lesson 3:
Compilers
are back
Flutter Impeller: Compile shaders
ahead-of-time, not at run-time
Requires different rendering backend:
tesselate into many primitive triangles
instead of generating specialized
shaders
Write all shaders in GLSL, compile to
Metal / Vulkan
Lessons 1. Declarative UI won
2. Frameworks limit performance
3. Compilers are back
4.
5.
Lesson 4:
Programming
languages
are back?!
End of end of history (viz Java)
Declarative UI: Functional reactive
programming (FRP)
Declarative syntax requiring language
work
Are all languages the same?
Dart, Swift
Lesson 4:
Programming
languages
are back?!
Types! Swift, Dart, TypeScript
Co-design of language with plaform
Dart went sound and null-safe for
better AOT performance and binary
size
❧
Shift from run-times to compilers
Lessons 1. Declarative UI won
2. Frameworks limit performance
3. Compilers are back
4. Programming languages are back?!
5.
Lesson 5:
There’s no
winner yet
Marginal cross-platform app
development, viz Signal
Even relative winners have “new
architecture”
React Native: Fabric
❧
Flutter: Impeller
❧
Froth in JavaScript space: new winner
every other year
Flutter bundles the kitchen sink
Lesson 5:
There’s no
winner yet
Lots of awkward choices
Jetpack Compose
❧
ArkTS eTS
❧
React Native / Hermes needing
transpilers
❧
“Do we know how to build apps?”
Lessons 1. Declarative UI won
2. Frameworks limit performance
3. Compilers are back
4. Programming languages are back?!
5. No winner yet
There is space for something else
What is to
be done?
What is to
be done?
Use Flutter
What is to
be done?
Use Flutter
Caveats: Text, Impeller, Google
What is to
be done?
Rust?!?
Future 1:
Rust
Declarative: Dioxus, dioxuslabs.com
fn app(cx: Scope) -> Element {
cx.render(rsx!{
div {
"Hello, world!"
}
})
}
Experimental WebGPU backend
Other options out there
Future 1:
Rust
State story limited (same as React)
Compilers? Yes! Predictable AOT
Language: lightweight
experimentation via macros; rsx!
Flutter on Rust is great pitch
Future 2
Future 2: JS Ride wave of JavaScript popularity
Lots of activity: NativeScript,
Capacitor, React Native, ...
Native widgets: NativeScript, React
Native
AOT compilation: ~NativeScript, React
Native
Still room for new frameworks
Future 2: JS Risk: you sail in the wake of a big ship
Flutter’s choice to abandon JS
understandable though also risky
Far-sighted option: sound typing for
TypeScript
Future 3 What does Flutter need from a
platform? Build that
Future 3:
Wasm and
WebGPU
...and WebHID and ARIA and
WebBluetooth and...
Pitch: commoditize platforms by
providing same binary ABI
User apps are Wasm modules that
import WebGPU et al capabilities
Efficient interoperation facilitated by
GC in WebAssembly 2.0
Summary Apps at the end of the end of history
Declarative
❧
Platform / language codesign
❧
Strong cross-platform contenders:
React Native and Flutter
There is room for more
Crystal ball: in 2y, Flutter in Rust; in
5y, sound TypeScript AOT
To read more: wingolog.org

More Related Content

What's hot

What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...Simplilearn
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerInstruqt
 
An Introduction to WebAssembly
An Introduction to WebAssemblyAn Introduction to WebAssembly
An Introduction to WebAssemblyDaniel Budden
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS IntroductionDavid Ličen
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
Role based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesRole based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesMilan Das
 
Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
Continuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesContinuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesAtlassian
 
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...Edureka!
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with JenkinsEdureka!
 

What's hot (20)

DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Introduction to react js
Introduction to react jsIntroduction to react js
Introduction to react js
 
React Native Workshop
React Native WorkshopReact Native Workshop
React Native Workshop
 
An Introduction to WebAssembly
An Introduction to WebAssemblyAn Introduction to WebAssembly
An Introduction to WebAssembly
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Role based access control - RBAC - Kubernetes
Role based access control - RBAC - KubernetesRole based access control - RBAC - Kubernetes
Role based access control - RBAC - Kubernetes
 
Maven Overview
Maven OverviewMaven Overview
Maven Overview
 
Jenkins
JenkinsJenkins
Jenkins
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Continuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesContinuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket Pipelines
 
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
React Components Lifecycle | React Tutorial for Beginners | ReactJS Training ...
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Getting started with Jenkins
Getting started with JenkinsGetting started with Jenkins
Getting started with Jenkins
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 

Similar to Cross-platform UI Engines Rendering Performance

Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
 
The Javascript Ecosystem
The Javascript EcosystemThe Javascript Ecosystem
The Javascript EcosystemEmmanuel Akinde
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyUlrich Krause
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDevelcz
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Mikkel Flindt Heisterberg
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software DevelopmentZeeshan MIrza
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 
Writing native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScriptWriting native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScriptIgalia
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in ProductionSeokjun Kim
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Eugene Yokota
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...Codemotion
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Alessio Ricco
 

Similar to Cross-platform UI Engines Rendering Performance (20)

React native
React nativeReact native
React native
 
Modern frontend in react.js
Modern frontend in react.jsModern frontend in react.js
Modern frontend in react.js
 
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptProgscon 2017: Taming the wild fronteer - Adventures in Clojurescript
Progscon 2017: Taming the wild fronteer - Adventures in Clojurescript
 
Compose in Theory
Compose in TheoryCompose in Theory
Compose in Theory
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
The Javascript Ecosystem
The Javascript EcosystemThe Javascript Ecosystem
The Javascript Ecosystem
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého Schizma
 
Code generation
Code generationCode generation
Code generation
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 
Writing native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScriptWriting native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScript
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in Production
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator
 

More from Igalia

Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Igalia
 

More from Igalia (20)

Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...
 

Recently uploaded

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 

Recently uploaded (20)

Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 

Cross-platform UI Engines Rendering Performance

  • 1. Cross-Platform Mobile UI “Compilers, Compilers Everywhere” 27 June 2023 – EOSS Prague Andy Wingo Igalia, S.L.
  • 2. Apps apps apps This is a talk about apps; good apps And compilers; weird compilers And open source, cross-platform app frameworks And the unexpected end of the end of history
  • 3.
  • 4.
  • 5.
  • 6. Do we know how to make apps? SwiftUI ❧ React Native ❧ Java and Android views ❧ Jetpack Compose ❧ OpenGL / Vulkan ❧ AppKit ❧ Capacitor ❧ NativeScript ❧ Flutter ❧ UIKit ❧
  • 7. Step back I.M.H.O.—H before the O Observe and learn: look for meaning and motivation Come back with lessons, then apply them to now
  • 9. Lesson 1 The old thing: stateful widget trees var count = 0 let stack = new VStack let text = new Text("Count: (count)") stack.add_child(text) let button = new Button("Increment") button.set_onclick(|| count += 1 text.set_text("Count: (count)") ) stack.add_child(button) https://raphlinus.github.io/ui/ druid/2019/11/22/reactive-ui.html
  • 10. Lesson 1: Declarative UI won on the web The newer thing: Declarative UI 2013: React function Hello({ name }) { return ( <p>Hello from React, {name}!</p> ); } UI is a function: translate state to immutable tree of elements Nowadays many derivatives of this paradigm
  • 11. Lesson 1: Declarative UI won on Android 2019: Jetpack Compose @Composable fun MessageCard(name: String) { Text(text = "Hello from " + "Jetpack Compose, $name!"); } Sometimes UI tree implicitly collected instead of returned
  • 12. Lesson 1: Declarative UI won on iOS 2019: SwiftUI struct ContentView: view { var name: String var body: some View { Text("Hello from SwiftUI, (name)!") .padding() } } Particularly lovely ergonomics
  • 13. Lesson 1: Declarative UI won, cross- platform 2017: Flutter class Hello extends StatelessWidget { const Hello({required this.name, super.key}); final String name; @override Widget build(BuildContext context) { return Text('Hello from Flutter,' + '$name!'); } } Even when people abstract away from platform, they go declarative
  • 14. Lesson 1: Declarative UI won But why? 3 reasons Managers like it: Decompose UI into org chart (Conway’s law) ❧ Comprehensively avoid view/model state mismatch ❧ Developers seem to like it too ❧
  • 15. Lessons 1. Declarative UI won 2. 3. 4. 5.
  • 16. Lesson 2 The rise of the framework Developer declares UI ❧ Framework translates to imperative operations on e.g. GPU ❧ Framework determines when UI needs recomputation ❧ Observation: UI tree computation O(n) in UI size How to avoid performance disaster?
  • 17. Lesson 2: Frameworks limit performance Division of labor: app developers say what, framework developers say how Risky bargain 4 main techniques Managed state ❧ Incremental render ❧ Concurrent render ❧ Concurrent GC ❧
  • 18. Lesson 2: Frameworks limit performance Technique 1: Managed state Framework re-renders only when needed function Hello({ name }) { const [count, setCount] = useState(0); function inc() { setCount(x => x+1); } return ( <div> <p>Count: {count}</p> <button onclick={inc}>+1</button> </div> ); }
  • 19. Lesson 2: Frameworks limit performance Technique 2: Incremental render Functional on top, but always imperative underneath Web: DOM ❧ React Native: UIKit / Android view tree ❧ Flutter: GPU pipeline objects ❧ Don’t recreate whole DOM on each frame: just apply changes Pixels[N+1] := Pixels[N] + Diff(UI[N+1], UI[N])
  • 20. Lesson 2: Frameworks limit performance Technique 3: Concurrent render Basic: Build UI on one thread, render to GPU/DOM on another Hard on the web, easier on mobile Limited gains for per-frame concurrency
  • 21.
  • 22. Lesson 2: Frameworks limit performance Technique 4: Concurrent GC Concurrent: Runs while program runs. Move O(n) trace off main thread Without concurrent GC: // UI thread frame . frame . frame . pause: trace+finish . frame With concurrent GC: // UI thread frame . frame . frame . pause: finish . frame // GC thread trace................. Reduce long-pole GC pause
  • 23. Lesson 2: Frameworks limit performance Providing good performance is a framework concern Frameworks nudge app developers into good performance patterns Frameworks limit performance too
  • 24. Lessons 1. Declarative UI won 2. Frameworks limit performance 3. 4. 5.
  • 26. Lesson 3: Compilers are back Example 1: Front-end @Composable fun MessageCard(name: String) { Text(text = "Hello from " + "Jetpack Compose, $name!"); } @Composable decorator: make it look like you declare a tree, but compile to imperative operations
  • 27. Lesson 3: Compilers are back Not just Jetpack Compose SwiftUI ResultBuilder ❧ HarmonyOS ArkUI with “eTS” ❧ React JSX ❧ Compilers are a core part of the modern UI story To work in this space: control the means of production
  • 28. Lesson 3: Compilers are back Example 2: Deployment Problem: Minimize startup latency, maximize runtime predictability Trend: Move to ahead-of-time compilation React Native Hermes ❧ Panda ArkTS (without eval!) ❧ Dart AOT ❧ Predictability over performance
  • 30.
  • 31. Lesson 3: Compilers are back Flutter Impeller: Compile shaders ahead-of-time, not at run-time Requires different rendering backend: tesselate into many primitive triangles instead of generating specialized shaders Write all shaders in GLSL, compile to Metal / Vulkan
  • 32.
  • 33. Lessons 1. Declarative UI won 2. Frameworks limit performance 3. Compilers are back 4. 5.
  • 34. Lesson 4: Programming languages are back?! End of end of history (viz Java) Declarative UI: Functional reactive programming (FRP) Declarative syntax requiring language work Are all languages the same? Dart, Swift
  • 35. Lesson 4: Programming languages are back?! Types! Swift, Dart, TypeScript Co-design of language with plaform Dart went sound and null-safe for better AOT performance and binary size ❧ Shift from run-times to compilers
  • 36. Lessons 1. Declarative UI won 2. Frameworks limit performance 3. Compilers are back 4. Programming languages are back?! 5.
  • 37. Lesson 5: There’s no winner yet Marginal cross-platform app development, viz Signal Even relative winners have “new architecture” React Native: Fabric ❧ Flutter: Impeller ❧ Froth in JavaScript space: new winner every other year Flutter bundles the kitchen sink
  • 38. Lesson 5: There’s no winner yet Lots of awkward choices Jetpack Compose ❧ ArkTS eTS ❧ React Native / Hermes needing transpilers ❧ “Do we know how to build apps?”
  • 39. Lessons 1. Declarative UI won 2. Frameworks limit performance 3. Compilers are back 4. Programming languages are back?! 5. No winner yet There is space for something else
  • 40. What is to be done?
  • 41. What is to be done? Use Flutter
  • 42. What is to be done? Use Flutter Caveats: Text, Impeller, Google
  • 43. What is to be done?
  • 45. Future 1: Rust Declarative: Dioxus, dioxuslabs.com fn app(cx: Scope) -> Element { cx.render(rsx!{ div { "Hello, world!" } }) } Experimental WebGPU backend Other options out there
  • 46. Future 1: Rust State story limited (same as React) Compilers? Yes! Predictable AOT Language: lightweight experimentation via macros; rsx! Flutter on Rust is great pitch
  • 48. Future 2: JS Ride wave of JavaScript popularity Lots of activity: NativeScript, Capacitor, React Native, ... Native widgets: NativeScript, React Native AOT compilation: ~NativeScript, React Native Still room for new frameworks
  • 49. Future 2: JS Risk: you sail in the wake of a big ship Flutter’s choice to abandon JS understandable though also risky Far-sighted option: sound typing for TypeScript
  • 50. Future 3 What does Flutter need from a platform? Build that
  • 51. Future 3: Wasm and WebGPU ...and WebHID and ARIA and WebBluetooth and... Pitch: commoditize platforms by providing same binary ABI User apps are Wasm modules that import WebGPU et al capabilities Efficient interoperation facilitated by GC in WebAssembly 2.0
  • 52. Summary Apps at the end of the end of history Declarative ❧ Platform / language codesign ❧ Strong cross-platform contenders: React Native and Flutter There is room for more Crystal ball: in 2y, Flutter in Rust; in 5y, sound TypeScript AOT To read more: wingolog.org