SlideShare a Scribd company logo
1 of 43
1 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Adenilson Cavalcanti
BSc MSc
WebKit & Blink committer
W3C CSS WG member
How Servo renders the Web
2Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co.
Summary
Motivation
Rust and Servo
Concepts of Browser engines
Servo high level architecture
Anatomy of a CSS feature
3 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• All modern browser engines were designed 15 years
ago (KHTML, WebKit, Gecko, Blink).
• They fail to exploit full parallelism.
• Both in mobile and desktop we expect more cores
(but not faster clocked CPUs).
Motivation
4 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• Single-threaded:
• Javascript execution
• Layout
• Painting/rasterization
• Security issues derived from C/C++.
• Huge code bases.
Issues of current browser engines
5 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• New browser engine written in Rust.
• Parallel: layout, painting, selector matching.
• Targeting performance and battery saving.
Servo
6 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Demo
Running servo.
7 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Implementation strategy
• Rewrite layout, rendering, HTML/CSS parsing,
networking, core engine glue.
• Reuse JavaScript engine, EME containers,
graphics library, fonts.
• Bootstrap with OpenSSL, image libraries, etc.
8 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• Over 120 CSS properties are supported.
• Rendering real sites near correctly.
• Competitive perf in benchmarks.
• 2x-3x speedups on 4 cores.
Servo status
9 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Rust
10 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
What is Rust?
https://www.youtube.com/watch?v=oKwub2OpsG4
11 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Why Rust?
• It aims to solve some gruesome issues in
C/C++.
• Be more expressive for hard tasks.
• Safety X performance: have both!
The case for Rust
12 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• Compiled language (uses llvm).
• Memory safety.
• Concurrency.
• Parallelism.
Rust features
13 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
C++ x Rust
14 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
C++ example: anything
wrong here?
http://doc.rust-lang.org/nightly/intro.html#ownership
15 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Run on valgrind: warnings
16 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Using gdb to understand
what is happening…
17 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Address: 0x100103af0
Address
18 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Change! Now: 0x100103b10
Address
19 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Ref points to old address!
Compiler warnings won’t catch it:
20 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Rust to the rescue!
21 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Rust stops bugs from
happening.
22 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• Ownership
– Exactly one variable “owns” an allocated value
– Ownership may be transferred (move)
– Ownership may be temporary (borrow)
• Lifetime
– These variables’ scopes provide an upper bound on how long
that value lasts
• Memory safety without overhead
– No GC
– No SmartPointers
– No reference counting
23 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Concepts of browser engines
24 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
How a browser works…
25 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Reasons for lack of literature
First OS
50 60 70 80 90 00 10 20
Books?
First browse
r
OS books
time
Delay between a disruptive tech becoming widespread and t
he textbooks being published
26 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
High level flow
HTML
CSS
JS
Loader /
Parser
DOM
Tree
Script
Handler
Browser
UI
Layout* /
Rendering
user-generated input
*Calculating layout is referred as Reflow (Gecko) or Attachment (WebKit)
27 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo high-level architecture
More details at: http://arxiv.org/abs/1505.07383
HTML
CSS
JS
DOM
Flow
Tree
Display
Lists
Layers
Final
Output
Parsing Styling
Layout
RenderingCompositing
ScriptScript
28 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo threading architecture
Constellation
Renderer
LayoutScript
Pipeline 1 (iframe 1)
Renderer
LayoutScript
Pipeline 2 (iframe 2)
Tab 1
Renderer
LayoutScript
Pipeline 3 (iframe 3)
29 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo rendering pipeline
overview:
• Content (aka. Script):
• Creates and owns the DOM tree
• Layout:
• Takes from content a snapshot of the DOM tree
• Calculates style (attachment), building the flow tree
• Flow tree used to calculate the layout of nodes
• Layout of nodes used to build a display list
• Renderer:
• Receives a display list from layout
• Renders visible portions to one or more tiles in parallel
• Compositor:
• Composites the tiles from the renderer
• Sends the final image to the screen for display
30 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
• In Blink, layout will create a RenderTree with
RenderObjects that have geometric information
and know how to paint themselves.
• In Servo, layout will generate a FlowTree and later
DisplayLists are created from it.
Blink/WebKit Differences
31 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Renderer and Compositor
• Both Renderer and Compositor are:
• Decoupled from Layout (separate threads)
• Design aimed at responsiveness
• Compositor manages its memory.
• Screen is divided into a series of tiles:
• Rendered in parallel
• Required for mobile performance
• Display lists are divided in sublists (i.e. stack context):
• Contents can be retained on the GPU
• Rendered in parallel
32 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Demo
• Dump flowtree, display lists.
• Parallel layout, parallel painting.
33 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Parallel layout challenges
• HTML layout has complex dependencies:
– Inline element positioning
– Floating elements
– Vertical text
– Pagination
• Each page is very different, making static
parallelism prediction difficult.
34 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Parallel layout
div
div
div
Queue
36 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Parallelism reduces page appearance
time
37 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
CSS filter blur
Code analysis.
38 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo detailed roadmap
• https://github.com/servo/servo/wiki/Roadmap
• Q2 2015
– Increase Servo quality - work on more sites
– Demonstrate superior end-to-end
performance
– Mobile / embedded
• 2015
– Full Alpha-quality release
39 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Contributing to Servo &
Rust
Contributions are welcome!
• Servo: github.com/mozilla/servo
• Rust: github.com/mozilla/rust | rust-lang.org
• #servo | #rust | #rust-internals @ irc.mozilla.org
• dev-servo | rust-dev @ lists.mozilla.org
• News: http://blog.servo.org/
40 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Special thanks
• Samsung OSG (OpenSource Group).
• Lars Bergstrom (Mozilla).
• Bruno Abinader (Mapbox).
41Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co.
Questions?
Thank you.
42Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co.
43 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo vs. Gecko (CNN)
44 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley)
Servo vs. Gecko (reddit)

More Related Content

Similar to How Servo Renders the Web Faster

Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...
Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...
Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...Derek Ashmore
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Servo: The parallel web engine
Servo: The parallel web engineServo: The parallel web engine
Servo: The parallel web engineBruno Abinader
 
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFLEnlightenmentProject
 
Containerizing couchbase with microservice architecture on mesosphere.pptx
Containerizing couchbase with microservice architecture on mesosphere.pptxContainerizing couchbase with microservice architecture on mesosphere.pptx
Containerizing couchbase with microservice architecture on mesosphere.pptxRavi Yadav
 
(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?Steve Poole
 
A295 nodejs-knowledge-accelerator
A295   nodejs-knowledge-acceleratorA295   nodejs-knowledge-accelerator
A295 nodejs-knowledge-acceleratorMichael Dawson
 
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Amazon Web Services
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconAdrian Cockcroft
 
Delivering Mobile Apps That Perform
Delivering Mobile Apps That PerformDelivering Mobile Apps That Perform
Delivering Mobile Apps That PerformRuben Goncalves
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackJeffrey Rondeau
 
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Vadym Kazulkin
 
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...Adrian Cockcroft
 
Microservices and Docker at Scale: The PB&J of Modern Systems
Microservices and Docker at Scale: The PB&J of Modern SystemsMicroservices and Docker at Scale: The PB&J of Modern Systems
Microservices and Docker at Scale: The PB&J of Modern SystemsTechWell
 
Workshop About Software Engineering Skills 2019
Workshop About Software Engineering Skills 2019Workshop About Software Engineering Skills 2019
Workshop About Software Engineering Skills 2019PhuocNT (Fresher.VN)
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Maximiliano Firtman
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
 

Similar to How Servo Renders the Web Faster (20)

Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...
Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...
Application Deployment Patterns in the Cloud - NOVA Cloud and Software Engine...
 
How Servo Renders the Web
How Servo Renders the WebHow Servo Renders the Web
How Servo Renders the Web
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Duel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & SkiaDuel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & Skia
 
Servo: The parallel web engine
Servo: The parallel web engineServo: The parallel web engine
Servo: The parallel web engine
 
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL
[E-Dev-Day 2014][14/16] Adding vector graphics support to EFL
 
Containerizing couchbase with microservice architecture on mesosphere.pptx
Containerizing couchbase with microservice architecture on mesosphere.pptxContainerizing couchbase with microservice architecture on mesosphere.pptx
Containerizing couchbase with microservice architecture on mesosphere.pptx
 
(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?(java2days) Is the Future of Java Cloudy?
(java2days) Is the Future of Java Cloudy?
 
A295 nodejs-knowledge-accelerator
A295   nodejs-knowledge-acceleratorA295   nodejs-knowledge-accelerator
A295 nodejs-knowledge-accelerator
 
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at Gluecon
 
Delivering Mobile Apps That Perform
Delivering Mobile Apps That PerformDelivering Mobile Apps That Perform
Delivering Mobile Apps That Perform
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable Stack
 
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
 
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...
CMG2013 Workshop: Netflix Cloud Native, Capacity, Performance and Cost Optimi...
 
CSS 3, Style and Beyond
CSS 3, Style and BeyondCSS 3, Style and Beyond
CSS 3, Style and Beyond
 
Microservices and Docker at Scale: The PB&J of Modern Systems
Microservices and Docker at Scale: The PB&J of Modern SystemsMicroservices and Docker at Scale: The PB&J of Modern Systems
Microservices and Docker at Scale: The PB&J of Modern Systems
 
Workshop About Software Engineering Skills 2019
Workshop About Software Engineering Skills 2019Workshop About Software Engineering Skills 2019
Workshop About Software Engineering Skills 2019
 
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
 
Containers, microservices and serverless for realists
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

How Servo Renders the Web Faster

  • 1. 1 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Adenilson Cavalcanti BSc MSc WebKit & Blink committer W3C CSS WG member How Servo renders the Web
  • 2. 2Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co. Summary Motivation Rust and Servo Concepts of Browser engines Servo high level architecture Anatomy of a CSS feature
  • 3. 3 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • All modern browser engines were designed 15 years ago (KHTML, WebKit, Gecko, Blink). • They fail to exploit full parallelism. • Both in mobile and desktop we expect more cores (but not faster clocked CPUs). Motivation
  • 4. 4 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • Single-threaded: • Javascript execution • Layout • Painting/rasterization • Security issues derived from C/C++. • Huge code bases. Issues of current browser engines
  • 5. 5 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • New browser engine written in Rust. • Parallel: layout, painting, selector matching. • Targeting performance and battery saving. Servo
  • 6. 6 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Demo Running servo.
  • 7. 7 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Implementation strategy • Rewrite layout, rendering, HTML/CSS parsing, networking, core engine glue. • Reuse JavaScript engine, EME containers, graphics library, fonts. • Bootstrap with OpenSSL, image libraries, etc.
  • 8. 8 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • Over 120 CSS properties are supported. • Rendering real sites near correctly. • Competitive perf in benchmarks. • 2x-3x speedups on 4 cores. Servo status
  • 9. 9 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Rust
  • 10. 10 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) What is Rust? https://www.youtube.com/watch?v=oKwub2OpsG4
  • 11. 11 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Why Rust? • It aims to solve some gruesome issues in C/C++. • Be more expressive for hard tasks. • Safety X performance: have both! The case for Rust
  • 12. 12 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • Compiled language (uses llvm). • Memory safety. • Concurrency. • Parallelism. Rust features
  • 13. 13 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) C++ x Rust
  • 14. 14 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) C++ example: anything wrong here? http://doc.rust-lang.org/nightly/intro.html#ownership
  • 15. 15 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Run on valgrind: warnings
  • 16. 16 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Using gdb to understand what is happening…
  • 17. 17 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Address: 0x100103af0 Address
  • 18. 18 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Change! Now: 0x100103b10 Address
  • 19. 19 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Ref points to old address! Compiler warnings won’t catch it:
  • 20. 20 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Rust to the rescue!
  • 21. 21 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Rust stops bugs from happening.
  • 22. 22 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • Ownership – Exactly one variable “owns” an allocated value – Ownership may be transferred (move) – Ownership may be temporary (borrow) • Lifetime – These variables’ scopes provide an upper bound on how long that value lasts • Memory safety without overhead – No GC – No SmartPointers – No reference counting
  • 23. 23 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Concepts of browser engines
  • 24. 24 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) How a browser works…
  • 25. 25 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Reasons for lack of literature First OS 50 60 70 80 90 00 10 20 Books? First browse r OS books time Delay between a disruptive tech becoming widespread and t he textbooks being published
  • 26. 26 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) High level flow HTML CSS JS Loader / Parser DOM Tree Script Handler Browser UI Layout* / Rendering user-generated input *Calculating layout is referred as Reflow (Gecko) or Attachment (WebKit)
  • 27. 27 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo high-level architecture More details at: http://arxiv.org/abs/1505.07383 HTML CSS JS DOM Flow Tree Display Lists Layers Final Output Parsing Styling Layout RenderingCompositing ScriptScript
  • 28. 28 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo threading architecture Constellation Renderer LayoutScript Pipeline 1 (iframe 1) Renderer LayoutScript Pipeline 2 (iframe 2) Tab 1 Renderer LayoutScript Pipeline 3 (iframe 3)
  • 29. 29 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo rendering pipeline overview: • Content (aka. Script): • Creates and owns the DOM tree • Layout: • Takes from content a snapshot of the DOM tree • Calculates style (attachment), building the flow tree • Flow tree used to calculate the layout of nodes • Layout of nodes used to build a display list • Renderer: • Receives a display list from layout • Renders visible portions to one or more tiles in parallel • Compositor: • Composites the tiles from the renderer • Sends the final image to the screen for display
  • 30. 30 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) • In Blink, layout will create a RenderTree with RenderObjects that have geometric information and know how to paint themselves. • In Servo, layout will generate a FlowTree and later DisplayLists are created from it. Blink/WebKit Differences
  • 31. 31 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Renderer and Compositor • Both Renderer and Compositor are: • Decoupled from Layout (separate threads) • Design aimed at responsiveness • Compositor manages its memory. • Screen is divided into a series of tiles: • Rendered in parallel • Required for mobile performance • Display lists are divided in sublists (i.e. stack context): • Contents can be retained on the GPU • Rendered in parallel
  • 32. 32 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Demo • Dump flowtree, display lists. • Parallel layout, parallel painting.
  • 33. 33 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Parallel layout challenges • HTML layout has complex dependencies: – Inline element positioning – Floating elements – Vertical text – Pagination • Each page is very different, making static parallelism prediction difficult.
  • 34. 34 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Parallel layout div div div Queue
  • 35. 36 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Parallelism reduces page appearance time
  • 36. 37 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) CSS filter blur Code analysis.
  • 37. 38 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo detailed roadmap • https://github.com/servo/servo/wiki/Roadmap • Q2 2015 – Increase Servo quality - work on more sites – Demonstrate superior end-to-end performance – Mobile / embedded • 2015 – Full Alpha-quality release
  • 38. 39 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Contributing to Servo & Rust Contributions are welcome! • Servo: github.com/mozilla/servo • Rust: github.com/mozilla/rust | rust-lang.org • #servo | #rust | #rust-internals @ irc.mozilla.org • dev-servo | rust-dev @ lists.mozilla.org • News: http://blog.servo.org/
  • 39. 40 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Special thanks • Samsung OSG (OpenSource Group). • Lars Bergstrom (Mozilla). • Bruno Abinader (Mapbox).
  • 40. 41Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co. Questions?
  • 41. Thank you. 42Open Source Group – Samsung Research America (Silicon Valley) © 2014 Samsung Electronics Co.
  • 42. 43 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo vs. Gecko (CNN)
  • 43. 44 © 2014 Samsung Electronics Co.Open Source Group – Samsung Research America (Silicon Valley) Servo vs. Gecko (reddit)

Editor's Notes

  1. Howdy!
  2. Each tab in servo is represented by a lightweight task thread that implements the Constellation (name is historical). There is a separate thread that handles UI compositing not shown here. Up to this point, we are similar to current Webkit and future Gecko. Within the page in that tab, there is a pipeline that implements the script, layout, and actual rendering. For each iframe, things get interesting. We have a pipeline that consists of three concurrent tasks. The script task handles loading the DOM and JavaScript engine. The layout task turns that into a tree of CSS boxes. The Renderer task turns that into tiles to be displayed on the screen. This architecture permits both parallelism that we didn’t have before and stability. <animate> You can add another pipeline when you add another iframe. And a third iframe can be added, optionally sharing the script task, which can be required in order to support some Web features.
  3. The biggest challenge is that HTML layout is really complicated. Inline elements, like text with various formatting, can require information from its neighbors to know its own position. Floating elements can either shift or even forcibly break (when they have a pinned location) a line in places that do not respect a sequential order of evaluating the DOM nodes. We’re thinking of adding speculative parallelism, but it’s unclear if the extra costs (ability to back out) outweigh the parallelism gains. More evaluation to do here.
  4. Assume we have a page with a body that has three divs, each of which has some text. A top-down traversal (e.g., computing widths) allows the three divs, red, blue, and white to each be rendered in parallel.
  5. These are power numbers for the overall process. Biggest thing to note is that most of the power difference comes from the frequency change, not the number of active cores (not necessarily true on mobile). The big take-away here is that you can save nearly 40% power usage without sacrificing time in this scenario simply by using parallelism and a lower CPU frequency.