SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
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.

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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
 

Destacado (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 a 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 a 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
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

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.