optimizing efl - events.static.linuxfound.org
TRANSCRIPT
1Samsung Open Source Group
Optimizing EFL
All You Must Know on Boosting CPU, Memory and Battery Usage Performance
Cedric BAIL – Senior Open Source Developer
Samsung Open Source Group
2
Samsung Open Source Group
Enlightenment Foundation Libraries
Quick what is this “Enlightenment Foundation Libraries” ?
Benchmarking over the course of time with expedite
Impact of preloading and shared cache infrastructure
Impact of shared instance
Energy consumption analysis with ACME
Questions ?
3
Samsung Open Source Group
Enlightenment Foundation Libraries
What is this “Enlightenment Foundation Libraries” ?
• Toolkit created for Enlightenment 17
4
Samsung Open Source Group
Enlightenment Foundation Libraries
Enlightenment Foundation Libraries ?
• GUI toolkit targetting embedded device
• Designed for creating a WM, ended up ready for any kind of applications
• Licensed under a mix of LGPL and BSD license
• Optimized to reduce CPU, GPU, memory and battery usage
• Support international language requirement (LTR/RTL, UTF8)
• Support all variation of screen and input device (scale factor)
• Full themability (layout of the application included)
• Profile support
• Could be made to fit in 8MB with a minimal set of dependencies included
• Modular design
5
Samsung Open Source Group
Enlightenment Foundation Libraries
X11
OpenGL
EINAMEMPOOL
EVAS
JPEG
PNG
GIF
TIFF
EET
SVG
MORE...
XRENDER
OPENGL/ES
X11 (SOFTWARE)
FB (SOFTWARE)
MORE...
EET
EMBRYO
EDJE
ELEMENTARY E-DBUS DBUS
ECOREFILE
X11
CON
IPC
FB
EVAS
QUARTZ
INPUT
JOB
SDL
WIN32/CE
MORE...
EFREET
MEMORY (RAM) (DATA STRUCTURES)
DATA IN STORAGE (DISK/FLASH ETC.)
PIXELS ON A DISPLAY
IMAGE FILES IN STORAGE
OTHER APPLICATIONS AND SERVICES
USER INTERACTION AND FEEDBACK
INPUT DEVICES AND OTHER SYSTEM SERVICES AND COMPONENTS
ABSTRACTED UI COMPONENTS FROM STORAGE
FREEDESKTOP.ORG STANDARDS LAYER
FAST VIRTUAL MACHINE FOR LOGIC AUGMENTATION
6
Samsung Open Source Group
Enlightenment Foundation Libraries
Evas :
• The brain of EFL
• Scene graph library with more than 10 years of optimization in it
• Glytch free rendering
• Reduce overdrawing
• Reduce waste of memory by deduplicating as much as possible
• Compressed glyph rendering
• Portable (SDL, X11, Wayland, FB, DRM, Windows, Mac OS X, ...)
• Optimized software renderer (MMX, SSE*, Neon)
• Optimized use of GPU (optional)▪ Support partial update if driver do
▪ Reduce context and texture switch as much as possible
▪ Reduce memory overhead
7
Samsung Open Source Group
Enlightenment Foundation Libraries
8
Samsung Open Source Group
Enlightenment Foundation Libraries
Elementary :
• Widgets toolkit
• Use Edje and Evas infrastructure
• Screen and input independence achieved by :▪ Scale factor
▪ Finger size
• Profile support (define configuration on a per Window basis)
• Fully themable
• Support touchscreen
9
Samsung Open Source Group
Enlightenment Foundation Libraries
10
Samsung Open Source Group
Benchmarking over the course of time with Expedite
Optimization :Before optimizing anything, you need numbers !
Any benchmark is a partial view of an application
Try to reveal the biggest cost of all application into one
Never perfect, never going to be a complete perfect picture
You need reference point that are valid from one test to another
11
Samsung Open Source Group
Benchmarking over the course of time with Expedite
Expedite :EFL application trying to force as much frame on screen
Currently tests only Evas primitive directly
Work with all previous EFL version
Tests specific path in our rendering pipeline
If EFL support a target, expedite will work
Give you a picture on how powerful a hardware is
12
Samsung Open Source Group
Benchmarking over the course of time with Expedite
expedite score0
50
100
150
200
250
300
350
400
Software i7
GL i7
RPi
13
Samsung Open Source Group
Benchmarking over the course of time with Expedite
0
100
200
300
400
500
600
700
1.8
1.9
1.10
1.11
1.12
14
Samsung Open Source Group
Benchmarking over the course of time with Expedite
1.8 1.9 1.10 1.11 1.12300
310
320
330
340
350
360
EVAS SPEED (WEIGHTED)
15
Samsung Open Source Group
Benchmarking over the course of time with Expedite
Conclusion :Benchmarking in a reliable way is difficult
Even with multiple round
Require some human intervention to understand what is going on
Give an overall idea of what is going on
Need more complex code
Need to improve logic to determine when the mesure is correct
16
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
EFL is designed for the embedded world, but is used on the desktop
Multiple application running at the same time
The more application can fully run at the same time the better
Time to first frame is critical
Scenario with no swap common
17
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
Reducing memory usage per application helpHaving a software backend help (GL consume more than 10MB)
Letting the kernel deal when to throw away data help (mmap)
Reducing memory duplication per process is a first step
• String share
• Eet
• Image/Font cache
• Copy On Write
18
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
Reducing memory usage globally is necessaryEvery application that is using EFL as at least one thing in common
EFL !Meaning that part of libraries initialisation could be shared
Welcome quicklaunch !
If application use the system theme, they have visually a lot in common
Image/Glyph/Font geometry are costly to load and consume memory
Sharing is doable, but tricky
Welcome Cserve2 !
19
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
Pros of quicklaunch :Libraries are preloaded in memory
Link is done once
Partial initialisation done once
Preload library in memory at boot time
Cons of quicklaunch :Tools need to read the updated argv[0]
Quicklaunch does some of the job of systemd –user
20
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
Pros of CServe2 :Decode image/glyph once
Share pixels data
Faster startup time, reduced memory usage
Cons of quicklaunch :Propagate security credential not implemented, only user level
No integration with kernel to act in OOM situation
Difficult to do restart on crash without crashing client
Need client to have the same theme !!!
21
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
RPi Free memory RPi Cached memory0
10000
20000
30000
40000
50000
60000
70000
80000
None
Quicklaunch
CServe2
Quicklaunch + CServe2
22
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
ELM_FIRST_FRAME=t elemines0
0,5
1
1,5
2
2,5
3
3,5
4
4,5
None
Quicklaunch
CServe2
Quicklaunch + CServe2
23
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
Power consumption :Normal = 2W * 4.20s
Quicklaunch = 2W * 2.97s
Cserve2 = 2W * 4.26s
Quicklaunch + Cserve2 = 2W * 3.10s
(Energy consumption is an average)
24
Samsung Open Source Group
Impact of preloading and shared cache infrastructure
ConclusionPreloading and partial initialisation of EFL does payoff
Could be improved by preconnecting to X and preloading theme
Need to find a proper fix to integrate with systemd user session
25
Samsung Open Source Group
Impact of shared instance
Alternative to preloading: single instance
Use case, one process, multiple window : Terminology
Doesn't apply to all applications
Doesn't provide process separation...
One goes down, everyone goes down !
26
Samsung Open Source Group
Impact of shared instance
27
Samsung Open Source Group
Impact of shared instance
RPi Free memory RPi Cached memory0
10000
20000
30000
40000
50000
60000
70000
80000
Multi process
Single instance
28
Samsung Open Source Group
Impact of shared instance
Conclusion :It does improve cost especially for big desktop application
Would be a good potential for systemd –user session
Has limitation that can't be overcome, so not a generic solution
29
Samsung Open Source Group
Energy consumption analysis with ACME
All energy mesurement where done with Open Source tools
Require a specific hardware based on BeagleBone Black
Great potential for automatic testing
Easy to read sensor without using the provided tool
Still a lot of change going on
Nice web interface and native user interface
Not perfect yet, but it's open source, so we can get it to do what we need !
Still lacking a benchmark mode
30
Samsung Open Source Group
Energy consumption analysis with ACME
31
Samsung Open Source Group
Energy consumption analysis with ACME
You can find more information at :
https://baylibre.com/acme/
32
Samsung Open Source Group
Enlightenment Foundation Libraries
EFL community cares about performance
So does Samsung for all its product line
There is always room for improvements
Evas scenegraph logic is more than 10 years old, refactoring and cleaning is necessary
Improving our tests suites and especially our benchmark is a permanent task
Never ending story ! Always something to improve !
33
Samsung Open Source Group
Samsung Open Source Group
WE ARE HIRING !Twitter: @SamsungOSGEmail: [email protected]
34Samsung Open Source Group
Questions ?
35Samsung Open Source Group
Thank you.