2. CONTENT
1. The History of Android Performance Features
2. Performance Comparison
of the Three Programming Models
3. Case Study :
Performance Features of the Google Chrome Browser
4. Questionnaire :
Multi-Core vs. GPU,
Android vs. Chrome,
and Beyond Android
3. Let’s go back to last summer.
“Why will Android always lag behind iOS?”
If you are a manufacturer,
how would you solve this problem?
What was OOOOOOO’s Approach?
1. The Optimization of SoC, Android Platform,
and Built-in Apps
2. Belief that this was Apple’s approach to
success
4. The history of Android Performance Features
• Android alpha (at least two internal releases)
• Android beta (5 Nov. 2007) – SDK : Java VM vs. Dalvik VM
• Android first commercial release (23 Sep. 2008)
• AOSP (21 Oct. 2008) – Zygote : Preload & Prelink (ASLR)
• Cupcake (27 Apr. 2009) – NDK & Stable native API
• Froyo (20 May 2010) – JIT (Just-in-time compilation)
• Jingerbread (6 Dec. 2010) – StrictMode & NativeActivity
• Honeycomb (22 Feb. 2011) – GPUI, SMP, and RenderScript
• JellyBean (27 Jun. 2012) - Project Butter (Jank Buster)
5. Fast & Smooth - Jelly Bean and Project Butter
Source : http://www.youtube.com/watch?v=V5E5revikUU
6. Facebook Android Development :
A Scrolling Performance Story - Dec 5, 2012
Their Android Performance Challenges
•
•
•
•
•
•
•
Why Android stutter more?
Measure Improvement
Garbage Collection
Memory
View Optimization
Main Thread
User Perception
Source : http://velocity.oreilly.com.cn/2012/ppts/Facebook-Android-Performance-OReilly-Velocity-Beijing-Dec-2012.pdf
7. The World of List View
Tuesday, June 1, 2010, Google I/O
FPS
60
50
40
30
20
10
0
Dumb
Recycling views
ViewHolder
Source : https://dl.google.com/googleio/2010/android-world-of-listview-android.pdf
8. Memory and Performance
March 29, 2013, 11th Kandroid Conference
Event
(AdapterView)
Invalidate
Measurement
A
Adapter
• getView()
Async
Drawable
Bitmap
Decoding
Storage
Network
I/O
B
• If an AdapterView has many children,
Dumb
part A is as important as part B.
Layout
Draw
Recycle
View
Holder
• If the AdapterView has few children,
part B becomes a bottleneck.
• Bitmap decoding is responsible.
Source : http://www.kandroid.org/board/data/board/conference/file_in_body/1/511th_kandroidconf_memory_and_performance.pdf
9. What lessons can we learn from history?
1. Always Measure
• Before beginning optimization, ensure the
problem requires solving.
2. Terminology used for Android Performance Features
• Bitmap Allocation
• Layer, DisplayList, DisplayList Property
• Input Latency
• FPS, VSync
10. CONTENT
1. The History of Android Performance Features
2. Performance Comparison
of the Three Programming Models
3. Case Study :
Performance Features of the Google Chrome Browser
4. Questionnaire :
Multi-Core vs. GPU,
Android vs. Chrome,
and Beyond Android
11. Comparison and Analysis of
the Three Programming Models
in Google Android (2012, Intel)
• What are the Three Programming Models ?
• Working Flow Comparison
• Execution Model Comparison
• Performance Difference and Analysis
• Differences in Development and Deployment
• Conclusion & Unified Programming Model
Source : http://people.apache.org/~xli/papers/applc2012-android-programming-models.pdf
12. What are the Three Programming Models?
2008
2009
M
AOSP
Branch
SDK
(API Level)
NDK
(Revision)
RenderScript
android.support.
v8.renderscript
1
2010
C
D E F
23
45 6 7 8
1 2
34
2011
GH
2012
I
9 10 13 1415
5
6 7
2014
2013
J
16
8
17
18
9
21. Current Issues & Unified Programming Model
2
Class
Programmability
Sub Class
SDK
NDK + RS
X
X
X
3
Library
Extensibility
O
Strong Typing
and Verification
O
X
O
O
Portability
Security
RS
O
Memory
Management
NDK
△
O
O
3
X
X
X
Vector Type
X
△
O
O
Thread Pool
O
△
O
O
OpenGLES
Performance
O
O
O
X
O
1
1. Is it possible to support vector type without changing the JNI implementation?
2. Why did Google make RS separate from NDK?
3. Are Memory Management and Strong Typing critical issues?
22. Current Issues & Unified Programming Model
GDK : What is GDK?
Hooray! We done the GDK building system.
This building system is independent on NDK.
It builds what is should (bitcodes), and then transfer the control
to NDK building system, doing the remaining building.
This code is still ugly. Need cleanup.
gdk git commit id : edde771d8940a6f1b00fd68bcca1486b575e6d9e
Author : Nowar Gu <nowar100@gmail.com>
23. GDK : hello-llvm Sample Code
Android-portable.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello_llvm
LOCAL_CFLAGS := -D NUM=7788
LOCAL_SRC_FILES := hello_llvm.c test.cpp
LOCAL_C_INCLUDES := jni/test-include
include $(BUILD_BITCODE)
include $(CLEAR_VARS)
LOCAL_MODULE := test2
LOCAL_SRC_FILES := test2.c
include $(BUILD_BITCODE)
Build Command
$ cd ~/android-4.1.1_r1/gdk/samples/hello-llvm/jni
$ export OUT=~/android-4.1.1_r1/out/target/product/generic
$ ../../../gdk-build --ndk-root=~/android-ndk-r8b
25. Google I/O 2013 : Game Development Env.
An Introduction to
Play Game Services
Game Services
In Practice
26. CONTENT
1. The History of Android Performance Features
2. Performance Comparison
of the Three Programming Models
3. Case Study :
Performance Features of the Google Chrome Browser
4. Questionnaire :
Multi-Core vs. GPU,
Android vs. Chrome,
and Beyond Android
29. Performance Features
of the Google Chrome Browser
• Why did Google Develop Chrome?
• Chrome’s Multi-process Architecture on Android
• Chrome’s Hardware Acceleration on Android
• Chrome’s Networking on Android
• Improved VSync scheduling for Chrome on Android
30. Why did Google Develop Chrome?
Chromium
Chrome browser :
uses multiple processes !
Chromium
safer
Sandbox the web app’s process
faster
Separate threads for separate web apps
blink
v8
more stable
Chromium OS
Fast rendering engine, small footprint
Out-of-Process iframes
Optimized JS engine,
many opportunities
Separate address spaces
for separate web apps
31. Chrome’s Multi-process Architecture on Android
Source : https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi-process-architecture
32. Chrome’s Multi-process Architecture on Android
Browser Process
Main
Thread
(UI)
I/O
Thread
Render Process
IPC
Main
Thread
Render
Thread
android:process=":sandboxed_process0" android:isolatedProcess="true“
android:process=":privileged_process2" android:isolatedProcess="false"
android:isolatedProcess
If set to true, this service will run under a special process that is isolated from the rest of
the system and has no permissions of its own. The only communication with it is
through the Service API (binding and starting).
33. Chrome’s Hardware Acceleration on Android
Software Rendering Architecture
Render Process
Shared
Memory
HWND
Bitmap
WebKit / Skia
Brower Process
IPC
Source : http://www.chromium.org/developers/design-documents/gpu-accelerated-compositing-in-chrome
34. Chrome’s Hardware Acceleration on Android
Compositing with the GPU process
Browser
Process
HWND
Shared
Memory
Render Process
Commands
GPU Process
(server)
WebKit / Skia
Bitmaps
& Arrays
Compositor
Context
Compositor
GL/D3D
IPC
Source : http://www.chromium.org/developers/design-documents/gpu-accelerated-compositing-in-chrome
38. Improved VSync Scheduling on Android
Improved vsync scheduling for Chrome on
Android - Author: skyostil@
• Motivation
• Improved vsync scheduling
• Vsync notification message
• Triggering vsync based on input
• Case studies
• Conclusion
Source : https://docs.google.com/a/chromium.org/document/d/16822du6DLKDZ1vQVNWI3gDVYoSqCSezgEmWZ0arvkP8/edit
39. Google I/O 2012 : For Butter or Worse - VSync
VSync
Drawing
without
VSync
0
VSync
1
1
1
2
3
CPU
3
3
Display
GPU
4
2
2
3
4
3
1
1
1
3
2
0
VSync
2
2
1
Drawing
with
VSync
VSync
4
4
Source : http://commondatastorage.googleapis.com/io2012/presentations/live%20to%20website/109.pdf
4
Display
GPU
CPU
40. Improved VSync Scheduling on Android
Old Architecture
System VSync
Browser
Process
internal
timer’s tick
Render
Process
41. Improved VSync Scheduling on Android
Old Architecture
~3.2ms
System VSync
internal
timer’s tick
Browser
Process
Render
Process
42. Improved VSync Scheduling on Android
Old Architecture and Problems
Source : https://docs.google.com/a/chromium.org/document/d/16822du6DLKDZ1vQVNWI3gDVYoSqCSezgEmWZ0arvkP8/edit
43. Improved VSync Scheduling on Android
New Architecture
~3.2ms
System VSync
internal
timer’s tick
Browser
Process
Render
Process
44. Improved VSync Scheduling on Android
New Architecture : Improvement and Problem
Source : https://docs.google.com/a/chromium.org/document/d/16822du6DLKDZ1vQVNWI3gDVYoSqCSezgEmWZ0arvkP8/edit
45. Improved VSync Scheduling on Android
New Architecture : Improvement and Limit
Conclusion
This document describes improvements to vsync scheduling which allows
Chrome on Android to generally respond to scroll gestures within a single
vsync interval. These improvements apply to regular page scrolling, while
lowering the latency of main thread and JavaScript-driven updates are left as
future work.
Source : https://docs.google.com/a/chromium.org/document/d/16822du6DLKDZ1vQVNWI3gDVYoSqCSezgEmWZ0arvkP8/edit
46. What lessons can we learn from Chrome?
1. On a GUI system, a scheduler for input and drawing
is the most important .
2. If you review Chrome technology in this perspective,
you can find valuable documents.
3. This is one document that is recommended.
https://docs.google.com/document/d/1LUFA8MDpJcDHE0_L2EHvrcwqOMJhzl5dqb0AlBSqHOY/edit
47. CONTENT
1. The History of Android Performance Features
2. Performance Comparison
of the Three Programming Models
3. Case Study :
Performance Features of the Google Chrome Browser
4. Questionnaire :
Multi-Core vs. GPU,
Android vs. Chrome,
and Beyond Android
49. Android vs. Chrome
We have two options: The first is maintaining the status
quo, the other is merging the two platforms.
Status Quo
• Android : Phone, Tablet, Google TV, Car
• Chromium : Chrome Brower, Chrome OS
Merged State
• Android-centric Merger
• Chrome-centric Merger
• Alternate Merger
50. Android vs. Chrome
For Android-centric merger to succeed,
we must answer one question:
“Is it possible to build chrome
via Android Infrastructure?”
For Chrome-centric merger to succeed,
we must answer a different question:
“Is it possible to run Android Apps in the Chrome?”
Do you have any alternate courses?
51. Beyond Android
With the current market saturation, is it possible to create
a new platform?
• B2G, Tizen, LG Web OS, Ubuntu Mobile
The successful development of a new platform could lead
to advances. Nevertheless, it would be just one more in
an already saturated market. So, we must streamline the
market and focus on cross-platform compatibility with
the status quo.
• Web-based (e.g. PhoneGap)
• Native-based (e.g. Cocos2d-x)
• VM-based (e.g. Mono)
52. CONTENT
1. The History of Android Performance Features
2. Performance Comparison of the Three
3.
4.
Programming Models
Case Study : Performance Features of the Google Chrome Browser
Questionnaire : Multi-Core vs. GPU, Android vs. Chrome, and Beyond Android
지금까지 경청해 주셔서 감사합니다.
질문 있으시면 해 주세요.