SlideShare a Scribd company logo
1 of 24
Download to read offline
Chrome DevTools
Rendering & Memory profiling
Open Academy 2013 Mate Nadasdi - Ustream, Inc
WHY DO WE NEED
A DEVTOOL?
• Javascript is an interpreted language
• HTML, CSS debugging have to happen in the browser
• Logging, debugging network requests is essential
• Source and the final output could be totally different
• Performance optimization is becoming increasingly important,
especially on mobile
Google is leading in new technologies
Native implementation and really fast support
Canary build deliver new features in really short intervals
Deep configuration possibilites
Early experimental access
Rendering / Memory Profiling tools
Why Google Chrome?
Red - Yellow - Blue?
Chrome channels
• Stable (Releases in every 6 weeks)
• Beta (1 month before stable, weekly releases)
• Dev (twice weekly)
• Canary (daily)
Chromium
Rendering
Parsing (HTML, XML, CSS, Javascript)
Layout
Text and graphics rendering
Image Decoding
GPU interaction
Network access
Hardware acceleration
Webkit / Blink rendering engine
Image Source: HTML5Rocks
From source to display - The ordinary way
HTML
HTML
Parser
Attachment
CSS ParserStylesheets
Layout
Shared bitmap
DOM tree
CSSOM tree
Render Object
tree
Render Layer
tree
n..1
Layout (Reflow) & Repaint
Layout (reflow):
Parts of the render tree needs to be revalidated and node dimensions should be
recalculated.
Repaint:
Some part of the screen needs to be updated because of a reflow, node geometric
change or style change.
Possible reflows & repaints
• DOM actions (Add, Remove, Update DOM nodes)
• Hide/show with display: none (reflow & repaint)
• Hide/show with visibility: hidden (repaint only because of no geometric change)
• Adding stylesheet dynamically
• scrolling, resizing the window
• DOM queries can cause a reflow too
• offsetTop/Left/Right/Height
• scrollTop/Left/Right/Height
• clientTop/Left/Right/Height
• getComputedStyle
Tips to minimize reflow & repaint
• Try to minimize layout cost with smaller subtree modification
• Detach DOM nodes before huge manipulation
• Do not change styles one by one (use classes instead)
• Group DOM read and write actions to let the browser optimize reflows for you
(DOM queries flush the browser’s queue of changes)
• Cache queried values, do not query them in every case you use it
Compositing, You Are Welcome!
• There are more GraphicContexts
• New tree in our forest, Graphic Layer tree
• Composited RenderLayers get their own backing surface
• Upload painted bitmaps to the GPU as textures
• 256x256 tiles
• Different thread for compositing
• Much cheaper then paint
Frames & Jank
• 60 Hz = We have got 16.66 ms only! ( 60 Hz = 1 / ~0,016)
• 60FPS is important, because 60Hz is average refresh rate of devices
• Jank: every time you can’t create a frame when your screen refreshes
• vSync - generating new frames only between screen refreshes
• JavaScript timers fails because of inaccuracy and different frame rates
• requestAnimationFrame is a good solution
20ms 20ms 20ms 20ms 20ms 20ms 20ms
Display refresh at 60 hz:
Our frame creation:
DEMO! Rock with timeline panel!
Tips:
• Show paint rectangles: Use it to show expensive paints
• Show composited layer borders: Check your GPU compositing layers easily
• Enable continuous page repainting: Easy to find the most expensive layers
• chrome://tracing/: Detailed tracing system to track core functionalities
• Use JavaScript CPU profile with Flame chart to diagnose your yellow pieces.
Memory profiling
Javascript memory basics
Root object
• Top of the memory management system
• We cannot manipulate
• References global variables
Object variable
• Can reference other variables
Scalar variable
• number, boolean, etc
Object sizes
Shallow size
• Memory held directly by the object
• It can be significant for arrays and strings
Retained size
• Indirect memory hold
• A size what will be freed if the object will be terminated
• For primitive types retained size equals shallow size
Object’s retaining tree
Root
A
G
C
D
B
H
D object’s retaining tree is a graph, where paths are retaining paths from GC root to A.
Garbage
Garbage:
Variables wich are unreachable from the GC root node
Garbage collection:
Finds all garbages and frees it’s memory to the system
Leak:
Object that still has retaining path accidently
Possible leaks
• Closures
• Deleting DOM nodes without removing event handlers
• DOM could hold event listeners to objects wich are inactive already
• Cycles: two objects reference to each other when they retain each other
DevTools workflow tips
1. Search for possible memory leaks with timeline panel
2. Use heap snapshots to capture object graph
3. Use all four views of the snapshot panel:
• Summary: An overview of our heap grouped by constructor name
• Comparison: Compare two snapshots
• Containment: Structured view of object graph
• Dominators: Find the most dominant points of the heap
4. Use the new Object Allocation Tracker in DevTools experiments
“Memory Lane with Gmail” talk about this new tool on Google IO 2013
https://developers.google.com/events/io/sessions/325547004
DEMO!
Tips:
• Check counters during your interaction on the examined page
• Use GC force button to see how it impacts on your memory
• Use it in incognito window, because extension allocated memory will be listed too
• Ignore:
• line in parentheses
• lines in light gray
• GC collects garbage before snapshot execution
Use Google Canary as it has all the features I have shown
and more including lots of profiling experiments
https://www.google.com/intl/en/chrome/browser/canary.html
Thank you!
@matenadasdi
Special thanks to Paul Irish and Addy Osmani for reviewing these slides.

More Related Content

What's hot

Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Dobrica Pavlinušić
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the BrowserFITC
 
Don't Fear the Platform
Don't Fear the PlatformDon't Fear the Platform
Don't Fear the PlatformESUG
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In HbaseGeorge Ang
 
NGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.jsNGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.jsdavrous
 
ScalaCache: simple caching in Scala
ScalaCache: simple caching in ScalaScalaCache: simple caching in Scala
ScalaCache: simple caching in ScalaChris Birchall
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYCChris Anderson
 
Front End Development Automation with Grunt
Front End Development Automation with GruntFront End Development Automation with Grunt
Front End Development Automation with GruntLadies Who Code
 
Phone Home: A client-side error collection system
Phone Home: A client-side error collection systemPhone Home: A client-side error collection system
Phone Home: A client-side error collection systemChris Birchall
 

What's hot (12)

Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
 
Don't Fear the Platform
Don't Fear the PlatformDon't Fear the Platform
Don't Fear the Platform
 
Hypercubes In Hbase
Hypercubes In HbaseHypercubes In Hbase
Hypercubes In Hbase
 
NGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.jsNGF2014 - Create a 3d game with webgl and babylon.js
NGF2014 - Create a 3d game with webgl and babylon.js
 
Android 12 13_6
Android 12 13_6Android 12 13_6
Android 12 13_6
 
ScalaCache: simple caching in Scala
ScalaCache: simple caching in ScalaScalaCache: simple caching in Scala
ScalaCache: simple caching in Scala
 
OpenCms Days 2016: Multilingual websites with OpenCms
OpenCms Days 2016:   Multilingual websites with OpenCmsOpenCms Days 2016:   Multilingual websites with OpenCms
OpenCms Days 2016: Multilingual websites with OpenCms
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYC
 
Front End Development Automation with Grunt
Front End Development Automation with GruntFront End Development Automation with Grunt
Front End Development Automation with Grunt
 
Phone Home: A client-side error collection system
Phone Home: A client-side error collection systemPhone Home: A client-side error collection system
Phone Home: A client-side error collection system
 
NoSQL solutions
NoSQL solutionsNoSQL solutions
NoSQL solutions
 

Viewers also liked

Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014Máté Nádasdi
 
Optimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 confOptimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 confMáté Nádasdi
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stabilityMáté Nádasdi
 
Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?Gareth Hughes
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 

Viewers also liked (6)

Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014
 
Firefox OS Weekend
Firefox OS WeekendFirefox OS Weekend
Firefox OS Weekend
 
Optimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 confOptimizing browser experience - App!mobile 2013 conf
Optimizing browser experience - App!mobile 2013 conf
 
Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
 
Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?Measuring Front-End Performance - What, When and How?
Measuring Front-End Performance - What, When and How?
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar to Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013

Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentAkihiro Ikezoe
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/SESUG
 
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design PatternsMongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design PatternsMongoDB
 
AEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, IntegrationsAEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, Integrationsconnectwebex
 
AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015Jakub Kaniewski
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android DevicesIrene Duke
 
Machine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville MeetupMachine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville MeetupSri Ambati
 
Ruby in office time reboot
Ruby in office time rebootRuby in office time reboot
Ruby in office time rebootKentaro Goto
 
Latest Developments in H2O
Latest Developments in H2OLatest Developments in H2O
Latest Developments in H2OSri Ambati
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.arthurjamain
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceChin Huang
 
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design PatternsMongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design PatternsMongoDB
 
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...Vladimir Simek
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsFabian Jakobs
 
Chrome Internals: Paint and Composition
Chrome Internals: Paint and CompositionChrome Internals: Paint and Composition
Chrome Internals: Paint and CompositionDzmitry Varabei
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design PatternsMongoDB
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADDesign World
 

Similar to Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013 (20)

Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
 
Web Tools for GemStone/S
Web Tools for GemStone/SWeb Tools for GemStone/S
Web Tools for GemStone/S
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
 
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design PatternsMongoDB.local Dallas 2019: Advanced Schema Design Patterns
MongoDB.local Dallas 2019: Advanced Schema Design Patterns
 
AEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, IntegrationsAEM 6 DAM - Integrations, Integrations, Integrations
AEM 6 DAM - Integrations, Integrations, Integrations
 
AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015AEM DAM Integrations showcases - Connect Conference 2015
AEM DAM Integrations showcases - Connect Conference 2015
 
Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
 
Machine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville MeetupMachine Learning for Smarter Apps - Jacksonville Meetup
Machine Learning for Smarter Apps - Jacksonville Meetup
 
Ruby in office time reboot
Ruby in office time rebootRuby in office time reboot
Ruby in office time reboot
 
Latest Developments in H2O
Latest Developments in H2OLatest Developments in H2O
Latest Developments in H2O
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
 
Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
 
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design PatternsMongoDB.local Seattle 2019: Advanced Schema Design Patterns
MongoDB.local Seattle 2019: Advanced Schema Design Patterns
 
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
AWS CZSK Webinar - Migrácia desktopov a aplikácií do AWS cloudu s Amazon Work...
 
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDBMongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
MongoDB Days Silicon Valley: Winning the Dreamforce Hackathon with MongoDB
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
Chrome Internals: Paint and Composition
Chrome Internals: Paint and CompositionChrome Internals: Paint and Composition
Chrome Internals: Paint and Composition
 
Advanced Schema Design Patterns
Advanced Schema Design PatternsAdvanced Schema Design Patterns
Advanced Schema Design Patterns
 
OpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CADOpenCL & the Future of Desktop High Performance Computing in CAD
OpenCL & the Future of Desktop High Performance Computing in CAD
 

Recently uploaded

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Recently uploaded (20)

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013

  • 1. Chrome DevTools Rendering & Memory profiling Open Academy 2013 Mate Nadasdi - Ustream, Inc
  • 2. WHY DO WE NEED A DEVTOOL?
  • 3. • Javascript is an interpreted language • HTML, CSS debugging have to happen in the browser • Logging, debugging network requests is essential • Source and the final output could be totally different • Performance optimization is becoming increasingly important, especially on mobile
  • 4. Google is leading in new technologies Native implementation and really fast support Canary build deliver new features in really short intervals Deep configuration possibilites Early experimental access Rendering / Memory Profiling tools Why Google Chrome?
  • 5. Red - Yellow - Blue? Chrome channels • Stable (Releases in every 6 weeks) • Beta (1 month before stable, weekly releases) • Dev (twice weekly) • Canary (daily) Chromium
  • 7. Parsing (HTML, XML, CSS, Javascript) Layout Text and graphics rendering Image Decoding GPU interaction Network access Hardware acceleration Webkit / Blink rendering engine Image Source: HTML5Rocks
  • 8. From source to display - The ordinary way HTML HTML Parser Attachment CSS ParserStylesheets Layout Shared bitmap DOM tree CSSOM tree Render Object tree Render Layer tree n..1
  • 9. Layout (Reflow) & Repaint Layout (reflow): Parts of the render tree needs to be revalidated and node dimensions should be recalculated. Repaint: Some part of the screen needs to be updated because of a reflow, node geometric change or style change.
  • 10. Possible reflows & repaints • DOM actions (Add, Remove, Update DOM nodes) • Hide/show with display: none (reflow & repaint) • Hide/show with visibility: hidden (repaint only because of no geometric change) • Adding stylesheet dynamically • scrolling, resizing the window • DOM queries can cause a reflow too • offsetTop/Left/Right/Height • scrollTop/Left/Right/Height • clientTop/Left/Right/Height • getComputedStyle
  • 11. Tips to minimize reflow & repaint • Try to minimize layout cost with smaller subtree modification • Detach DOM nodes before huge manipulation • Do not change styles one by one (use classes instead) • Group DOM read and write actions to let the browser optimize reflows for you (DOM queries flush the browser’s queue of changes) • Cache queried values, do not query them in every case you use it
  • 12. Compositing, You Are Welcome! • There are more GraphicContexts • New tree in our forest, Graphic Layer tree • Composited RenderLayers get their own backing surface • Upload painted bitmaps to the GPU as textures • 256x256 tiles • Different thread for compositing • Much cheaper then paint
  • 13. Frames & Jank • 60 Hz = We have got 16.66 ms only! ( 60 Hz = 1 / ~0,016) • 60FPS is important, because 60Hz is average refresh rate of devices • Jank: every time you can’t create a frame when your screen refreshes • vSync - generating new frames only between screen refreshes • JavaScript timers fails because of inaccuracy and different frame rates • requestAnimationFrame is a good solution 20ms 20ms 20ms 20ms 20ms 20ms 20ms Display refresh at 60 hz: Our frame creation:
  • 14. DEMO! Rock with timeline panel! Tips: • Show paint rectangles: Use it to show expensive paints • Show composited layer borders: Check your GPU compositing layers easily • Enable continuous page repainting: Easy to find the most expensive layers • chrome://tracing/: Detailed tracing system to track core functionalities • Use JavaScript CPU profile with Flame chart to diagnose your yellow pieces.
  • 16. Javascript memory basics Root object • Top of the memory management system • We cannot manipulate • References global variables Object variable • Can reference other variables Scalar variable • number, boolean, etc
  • 17. Object sizes Shallow size • Memory held directly by the object • It can be significant for arrays and strings Retained size • Indirect memory hold • A size what will be freed if the object will be terminated • For primitive types retained size equals shallow size
  • 18. Object’s retaining tree Root A G C D B H D object’s retaining tree is a graph, where paths are retaining paths from GC root to A.
  • 19. Garbage Garbage: Variables wich are unreachable from the GC root node Garbage collection: Finds all garbages and frees it’s memory to the system Leak: Object that still has retaining path accidently
  • 20. Possible leaks • Closures • Deleting DOM nodes without removing event handlers • DOM could hold event listeners to objects wich are inactive already • Cycles: two objects reference to each other when they retain each other
  • 21. DevTools workflow tips 1. Search for possible memory leaks with timeline panel 2. Use heap snapshots to capture object graph 3. Use all four views of the snapshot panel: • Summary: An overview of our heap grouped by constructor name • Comparison: Compare two snapshots • Containment: Structured view of object graph • Dominators: Find the most dominant points of the heap 4. Use the new Object Allocation Tracker in DevTools experiments “Memory Lane with Gmail” talk about this new tool on Google IO 2013 https://developers.google.com/events/io/sessions/325547004
  • 22. DEMO! Tips: • Check counters during your interaction on the examined page • Use GC force button to see how it impacts on your memory • Use it in incognito window, because extension allocated memory will be listed too • Ignore: • line in parentheses • lines in light gray • GC collects garbage before snapshot execution
  • 23. Use Google Canary as it has all the features I have shown and more including lots of profiling experiments https://www.google.com/intl/en/chrome/browser/canary.html
  • 24. Thank you! @matenadasdi Special thanks to Paul Irish and Addy Osmani for reviewing these slides.