SlideShare ist ein Scribd-Unternehmen logo
1 von 24
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.

Weitere ähnliche Inhalte

Andere mochten auch

Myth essay
Myth essayMyth essay
Myth essaydomm7
 
My powerpoint presentations
My powerpoint presentationsMy powerpoint presentations
My powerpoint presentationsRazib M
 
Thylacine1
Thylacine1Thylacine1
Thylacine1y3ehps
 
Idejna rešenja - Srednja škola "Đura Jakšić" Rača
Idejna rešenja - Srednja škola "Đura Jakšić" RačaIdejna rešenja - Srednja škola "Đura Jakšić" Rača
Idejna rešenja - Srednja škola "Đura Jakšić" RačaMarko Milošević
 
NIZAM ENTERPRISE profile (1)
NIZAM ENTERPRISE profile (1)NIZAM ENTERPRISE profile (1)
NIZAM ENTERPRISE profile (1)hassand bindin
 
Tiger Tools for the Retail Store
Tiger Tools for the Retail StoreTiger Tools for the Retail Store
Tiger Tools for the Retail StoreTigerQuest
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрацияkaanow
 
Ariunaaaaaaaaaaa
AriunaaaaaaaaaaaAriunaaaaaaaaaaa
Ariunaaaaaaaaaaaariunaaaaaa
 
Purist Presentation 052513
Purist Presentation 052513Purist Presentation 052513
Purist Presentation 052513Norman Ash
 
Thylacine
ThylacineThylacine
Thylaciney3ehps
 
總體經濟指標
總體經濟指標總體經濟指標
總體經濟指標twnewone1
 
Newsbubble
NewsbubbleNewsbubble
Newsbubblepindec
 
2能源技術服務業
2能源技術服務業2能源技術服務業
2能源技術服務業twnewone1
 

Andere mochten auch (20)

Myth essay
Myth essayMyth essay
Myth essay
 
My powerpoint presentations
My powerpoint presentationsMy powerpoint presentations
My powerpoint presentations
 
Coding dojo
Coding dojoCoding dojo
Coding dojo
 
Presentation stremtsi
Presentation stremtsiPresentation stremtsi
Presentation stremtsi
 
Thylacine1
Thylacine1Thylacine1
Thylacine1
 
Idejna rešenja - Srednja škola "Đura Jakšić" Rača
Idejna rešenja - Srednja škola "Đura Jakšić" RačaIdejna rešenja - Srednja škola "Đura Jakšić" Rača
Idejna rešenja - Srednja škola "Đura Jakšić" Rača
 
NIZAM ENTERPRISE profile (1)
NIZAM ENTERPRISE profile (1)NIZAM ENTERPRISE profile (1)
NIZAM ENTERPRISE profile (1)
 
Tiger Tools for the Retail Store
Tiger Tools for the Retail StoreTiger Tools for the Retail Store
Tiger Tools for the Retail Store
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрация
 
Habitacao acessivel
Habitacao acessivelHabitacao acessivel
Habitacao acessivel
 
Trek2Freedom
Trek2FreedomTrek2Freedom
Trek2Freedom
 
Ariunaaaaaaaaaaa
AriunaaaaaaaaaaaAriunaaaaaaaaaaa
Ariunaaaaaaaaaaa
 
2011. informe 1º trimestre
2011. informe  1º trimestre2011. informe  1º trimestre
2011. informe 1º trimestre
 
Purist Presentation 052513
Purist Presentation 052513Purist Presentation 052513
Purist Presentation 052513
 
Thylacine
ThylacineThylacine
Thylacine
 
總體經濟指標
總體經濟指標總體經濟指標
總體經濟指標
 
Newsbubble
NewsbubbleNewsbubble
Newsbubble
 
M&s plan a rowland hill
M&s plan a   rowland hillM&s plan a   rowland hill
M&s plan a rowland hill
 
Test
TestTest
Test
 
2能源技術服務業
2能源技術服務業2能源技術服務業
2能源技術服務業
 

Ähnlich wie Dev tools rendering & memory profiling

Ustream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer ToolsUstream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer ToolsMáté Nádasdi
 
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
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the BrowserFITC
 
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
 

Ähnlich wie Dev tools rendering & memory profiling (20)

Ustream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer ToolsUstream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer Tools
 
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
 
Improving Game Performance in the Browser
Improving Game Performance in the BrowserImproving Game Performance in the Browser
Improving Game Performance in the Browser
 
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
 

Mehr von Open Academy

BDD demisztifikálva
BDD demisztifikálvaBDD demisztifikálva
BDD demisztifikálvaOpen Academy
 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...Open Academy
 
Firefox OS: hackelni könnyű
Firefox OS:  hackelni könnyűFirefox OS:  hackelni könnyű
Firefox OS: hackelni könnyűOpen Academy
 
BlackBerry10 alapú natív alkalmazásfejlesztés
BlackBerry10 alapú natív alkalmazásfejlesztésBlackBerry10 alapú natív alkalmazásfejlesztés
BlackBerry10 alapú natív alkalmazásfejlesztésOpen Academy
 
Android fejlesztés
Android fejlesztésAndroid fejlesztés
Android fejlesztésOpen Academy
 
A Windows Phone világa
A Windows Phone világaA Windows Phone világa
A Windows Phone világaOpen Academy
 
Okostelefonok és táblagépek menedzsmentje
Okostelefonok és táblagépek menedzsmentjeOkostelefonok és táblagépek menedzsmentje
Okostelefonok és táblagépek menedzsmentjeOpen Academy
 
Ipari felhő infrastruktúrák a gyakorlatban
Ipari felhő infrastruktúrák a gyakorlatbanIpari felhő infrastruktúrák a gyakorlatban
Ipari felhő infrastruktúrák a gyakorlatbanOpen Academy
 
Túlélés a Három Betűs Rövidítések világában
Túlélés a Három Betűs Rövidítések világábanTúlélés a Három Betűs Rövidítések világában
Túlélés a Három Betűs Rövidítések világábanOpen Academy
 
Adminisztratív protokollok ellenőrzési lehetőségei
Adminisztratív protokollok ellenőrzési lehetőségeiAdminisztratív protokollok ellenőrzési lehetőségei
Adminisztratív protokollok ellenőrzési lehetőségeiOpen Academy
 
Naplózás a gyakorlatban
Naplózás a gyakorlatbanNaplózás a gyakorlatban
Naplózás a gyakorlatbanOpen Academy
 
Hogyan optimalizáljunk C/C++ kódokat!
Hogyan optimalizáljunk C/C++ kódokat!Hogyan optimalizáljunk C/C++ kódokat!
Hogyan optimalizáljunk C/C++ kódokat!Open Academy
 
Hogy kerül a csizma az asztalra?
Hogy kerül a csizma az asztalra?Hogy kerül a csizma az asztalra?
Hogy kerül a csizma az asztalra?Open Academy
 
AGILIS / SCRUM fejlesztés
AGILIS / SCRUM fejlesztésAGILIS / SCRUM fejlesztés
AGILIS / SCRUM fejlesztésOpen Academy
 
Multiplatform mobil fejlesztések
Multiplatform mobil fejlesztésekMultiplatform mobil fejlesztések
Multiplatform mobil fejlesztésekOpen Academy
 
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?Webműves Kelemen tanácsai, avagy mi kell a PHP falába?
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?Open Academy
 
Verziókövető rendszerek alkalmazása fejlesztési projektekben
Verziókövető rendszerek alkalmazása fejlesztési projektekbenVerziókövető rendszerek alkalmazása fejlesztési projektekben
Verziókövető rendszerek alkalmazása fejlesztési projektekbenOpen Academy
 

Mehr von Open Academy (19)

BDD demisztifikálva
BDD demisztifikálvaBDD demisztifikálva
BDD demisztifikálva
 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...
 
Firefox OS: hackelni könnyű
Firefox OS:  hackelni könnyűFirefox OS:  hackelni könnyű
Firefox OS: hackelni könnyű
 
BlackBerry10 alapú natív alkalmazásfejlesztés
BlackBerry10 alapú natív alkalmazásfejlesztésBlackBerry10 alapú natív alkalmazásfejlesztés
BlackBerry10 alapú natív alkalmazásfejlesztés
 
Android fejlesztés
Android fejlesztésAndroid fejlesztés
Android fejlesztés
 
Magvas gondolatok
Magvas gondolatokMagvas gondolatok
Magvas gondolatok
 
A Windows Phone világa
A Windows Phone világaA Windows Phone világa
A Windows Phone világa
 
Okostelefonok és táblagépek menedzsmentje
Okostelefonok és táblagépek menedzsmentjeOkostelefonok és táblagépek menedzsmentje
Okostelefonok és táblagépek menedzsmentje
 
Windows 8
Windows 8Windows 8
Windows 8
 
Ipari felhő infrastruktúrák a gyakorlatban
Ipari felhő infrastruktúrák a gyakorlatbanIpari felhő infrastruktúrák a gyakorlatban
Ipari felhő infrastruktúrák a gyakorlatban
 
Túlélés a Három Betűs Rövidítések világában
Túlélés a Három Betűs Rövidítések világábanTúlélés a Három Betűs Rövidítések világában
Túlélés a Három Betűs Rövidítések világában
 
Adminisztratív protokollok ellenőrzési lehetőségei
Adminisztratív protokollok ellenőrzési lehetőségeiAdminisztratív protokollok ellenőrzési lehetőségei
Adminisztratív protokollok ellenőrzési lehetőségei
 
Naplózás a gyakorlatban
Naplózás a gyakorlatbanNaplózás a gyakorlatban
Naplózás a gyakorlatban
 
Hogyan optimalizáljunk C/C++ kódokat!
Hogyan optimalizáljunk C/C++ kódokat!Hogyan optimalizáljunk C/C++ kódokat!
Hogyan optimalizáljunk C/C++ kódokat!
 
Hogy kerül a csizma az asztalra?
Hogy kerül a csizma az asztalra?Hogy kerül a csizma az asztalra?
Hogy kerül a csizma az asztalra?
 
AGILIS / SCRUM fejlesztés
AGILIS / SCRUM fejlesztésAGILIS / SCRUM fejlesztés
AGILIS / SCRUM fejlesztés
 
Multiplatform mobil fejlesztések
Multiplatform mobil fejlesztésekMultiplatform mobil fejlesztések
Multiplatform mobil fejlesztések
 
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?Webműves Kelemen tanácsai, avagy mi kell a PHP falába?
Webműves Kelemen tanácsai, avagy mi kell a PHP falába?
 
Verziókövető rendszerek alkalmazása fejlesztési projektekben
Verziókövető rendszerek alkalmazása fejlesztési projektekbenVerziókövető rendszerek alkalmazása fejlesztési projektekben
Verziókövető rendszerek alkalmazása fejlesztési projektekben
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 

Dev tools rendering & memory profiling

  • 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.