Optimizing EFL All You Must Know on Boosting CPU, Memory and Battery Usage Performance Cedric BAIL – Senior Open Source Developer Samsung Open Source Group cedric@osg.samsung.com 1 Samsung Open Source Group
2 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 ? Samsung Open Source Group
3 Enlightenment Foundation Libraries What is this “Enlightenment Foundation Libraries” ? • Toolkit created for Enlightenment 17 Samsung Open Source Group
4 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 Samsung Open Source Group
5 Enlightenment Foundation Libraries USER INTERACTION AND FEEDBACK OTHER APPLICATIONS AND SERVICES DBUS ELEMENTARY E-DBUS EVAS MORE... INPUT DEVICES AND OTHER FB WIN32/CE IMAGE FILES SYSTEM SERVICES IPC SDL IN STORAGE ECORE CON JOB AND COMPONENTS FILE INPUT QUARTZ ABSTRACTED UI X11 OpenGL COMPONENTS EDJE FROM STORAGE JPEG OPENGL/ES PIXELS ON A PNG X11 (SOFTWARE) DISPLAY FB (SOFTWARE) SVG FREEDESKTOP .ORG EFREET TIFF XRENDER EVAS STANDARDS LAYER X11 GIF MORE... EMBRYO EET MORE... EINA EET MEMPOOL FAST VIRTUAL MACHINE FOR LOGIC AUGMENTATION MEMORY (RAM) (DATA STRUCTURES) DATA IN STORAGE (DISK/FLASH ETC.) Samsung Open Source Group
6 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 Samsung Open Source Group
7 Enlightenment Foundation Libraries Samsung Open Source Group
8 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 Samsung Open Source Group
9 Enlightenment Foundation Libraries Samsung Open Source Group
10 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 Samsung Open Source Group
11 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 Samsung Open Source Group
12 Benchmarking over the course of time with Expedite 400 350 300 250 Software i7 200 GL i7 RPi 150 100 50 0 expedite score Samsung Open Source Group
13 Benchmarking over the course of time with Expedite 700 600 500 400 1.8 300 1.9 1.10 200 1.11 1.12 100 0 Samsung Open Source Group
14 Benchmarking over the course of time with Expedite 360 350 340 EVAS SPEED (WEIGHTED) 330 320 310 300 1.8 1.9 1.10 1.11 1.12 Samsung Open Source Group
15 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 Samsung Open Source Group
16 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 Samsung Open Source Group
17 Impact of preloading and shared cache infrastructure Reducing memory usage per application help Having 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 Samsung Open Source Group
18 Impact of preloading and shared cache infrastructure Reducing memory usage globally is necessary Every 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 ! Samsung Open Source Group
19 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 Samsung Open Source Group
20 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 !!! Samsung Open Source Group
21 Impact of preloading and shared cache infrastructure 80000 70000 60000 50000 None Quicklaunch 40000 CServe2 Quicklaunch + CServe2 30000 20000 10000 0 RPi Free memory RPi Cached memory Samsung Open Source Group
22 Impact of preloading and shared cache infrastructure 4,5 4 3,5 3 None 2,5 Quicklaunch CServe2 2 Quicklaunch + CServe2 1,5 1 0,5 0 ELM_FIRST_FRAME=t elemines Samsung Open Source Group
23 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) Samsung Open Source Group
24 Impact of preloading and shared cache infrastructure Conclusion Preloading 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 Samsung Open Source Group
25 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 ! Samsung Open Source Group
26 Impact of shared instance Samsung Open Source Group
27 Impact of shared instance 80000 70000 60000 50000 Multi process 40000 Single instance 30000 20000 10000 0 RPi Free memory RPi Cached memory Samsung Open Source Group
28 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 Samsung Open Source Group
29 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 Samsung Open Source Group
30 Energy consumption analysis with ACME Samsung Open Source Group
31 Energy consumption analysis with ACME You can find more information at : https://baylibre.com/acme/ Samsung Open Source Group
32 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 ! Samsung Open Source Group
Recommend
More recommend