Upload
byungseon-shin
View
119
Download
0
Embed Size (px)
Citation preview
How to OptimizeWeb Engine
2015년 4월 29일TV Web Framework 팀
신 병 선
What’s in it Web Engine
Pros: Separation of Duty → JS Execution vs. User Interaction
Cons: Sharing Graphics Data→ Producer: Web(Render) Process→ Consumer: UI(Browser) Process
Multi Process Architecture
Execution Pipeline
Pros: FasterCons: Needs more memory!!!http://collab.lge.com/main/display/~sun.shin/Accelerated+Compositing+WebKit
Accelerated Compositing
Is Chrome/Blink really an answer?
What’s in iOS
Behind Core Animation
http://arstechnica.com/apple/2005/04/28/macosx-10-4/14/
Off-Screen Buffer SharingThe IOSurfaceAPI header contains the public API for the IOSurface framework. The IOSurface framework provides a framebuffer object suitable for sharing across process boundaries. It is commonly used to allow applications to move complex image decompression and draw logic into a separate process to enhance security.
WebKit Optimization on iOSFix Border-radius clipping issue on a composited descendants
https://bugs.webkit.org/show_bug.cgi?id=138551
Patch by Byungseon Shin < [email protected]> on 2015-01-07
Reviewed by Simon Fraser.
Fix clipping compositing descendants of an accelerated layer having
border radius and clip overflow issue by using layer corner-radius
or a CAShapeLayer mask on Mac, and setting up a separate mask layer
on the childContainmentLayer on other platforms.
Chromium UI Framework - Aura
Chromium - GPU Process
Threaded Compositing in Chromium… continued from page 4.
Optimization in Chromium - Slimming Painting
Project Goal● Faster recording/painting● Correct and faster compositing● Healthier, better tested code
How to achieve● Blink paint code not optimized for our compositor architecture nor Skia
○ Inherited 2 code paths: CG/CA & Skia/cc● We cache pixels, repeat work to define them
→ Lesson on Blink(WebKit), harden on Compositor & Skia
Slimming Painting DetailsDisplay(Paint) list concept already exists in Core Animation & Android UI Framework
Wayland - Ozone● Ozone is a platform abstraction layer beneath the Aura window
system that is used for low level input and graphics.● In Linux graphics, Mesa GBM provides the ability for user
application directly allocate accelerated graphics buffers.● Fullscreen Chromium targets such as ChromeOS, Chromecast
among others require minimal interaction with the native windowing system.
● Ozone-GBM is the native fullscreen-only platform that delegates the composition tasks of the root window to a new platform window based on KMS/DRM. It uses EGL/GLES2 for accelerated rendering. Besides, Ozone-GBM has an internal implementation of the Linux evdev subsystem.
● Fullscreen Chromium targets can use Ozone-GBM to remove unnecessary dependency on full-fledged window systems like X11, Wayland, DirectFB, etc.
What else besides GFX….● Using bmalloc allocator in WebKit
JS Engine: asm.js / turboPan / FTL
http://ariya.ofilabs.com/page/2Ultimately, TurboFan needs to generate some machine code. Predictably, it has its own code generator (currently for x86 and ARM, both 32-bit and 64-bit), it does not reuse the existing Hydrogen and Lithium code generators from Crankshaft.
Memory considerations ...● Counts the memory usage of every process● Take action to keep memory usage below the limit (drop caches, stop page loading etc.)● Process “negotiation” to keep global memory usage below the specified limit● Some fixes to avoid memory peaks
Memory allowance system(1/3)Memory Counting
● Hooks in tcmalloc and v8● Counts heap size (e.g. not individual malloc() amounts)● Count updated when heap is expanded or shrunk (not at every malloc())● File mappings are not counted (e.g. executable, libs, fonts, etc...)
Counting heap size gives us● An accurate count (system memory count)● A high count (better not count too low)● Less counter updates (more efficient)● An early count (gives a head start to react to memory growth)
Memory allowance system(2/3)Process workflow
● Start with a large memory allowance (quota).● Check allowance after each task.● Running out of allowance? - Request more.● Denied more allowance? - Dump caches.● Out of allowance? - Increase allowance and report it.
>>>> Requests and reports (may) require IPC!
● The receiving end of memory allowance requests and reports from processes.● Guards the limit (total memory allowance)● Keeps tab of the memory allowance.● Tells the processes to yield when allowance is running low (e.g. dump caches and stop loading)
Memory allowance system(3/3)● Hooks for counting in tcmalloc and V8● Hooks in message loop to jump the queue● Fail process startup on low memory● Resource loading can be put on hold
waiting for more allowance.
Let’s discuss what to do for webOS TV 3.0