SlideShare uma empresa Scribd logo
1 de 14
Repaint & Reflow
by Kingsley Zheng
● Repaint ( redraw )
Elements skin changes visibility , but do not affect it's
layout
e.g. outline , border
● Reflow
Affect the layout of a portion of the page
e.g. position , display
Repaints and reflows can be expensive, they can hurt
the user experience, and make the UI appear sluggish.
What is the different ?
What causes a repaint ?
● Change Visibility : hidden to visible
● Change background , border-color , color
● Elements skin changes visibility , but do not affect it's
layout
What causes a reflow ?
● Resizing the window
● Changing the font
● Adding or removing a stylesheet
● Content changes, such as a user typing text in an
input box
● Activation of CSS pseudo classes such as :hover (in
IE the activation of the pseudo class of a sibling)
● Manipulating the class attribute
● A script manipulating the DOM
● Calculating offsetWidth and offsetHeight
● Setting a property of the style attribute
Position
Property Change
Optimize
minimize reflow & repaint times
Create DOM
Get DOM before end
Get DOM first
Layout float
Dialog & Overlay
BetterBad!!!
Reference
● Yahoo關於性能優化的N條規則
http://www.ozchamp.com/knowledge_detail_727_ntid_147.html
● REFLOWS & REPAINTS: CSS PERFORMANCE
MAKING YOUR JAVASCRIPT SLOW?
http://www.stubbornella.org/content/2009/03/27/reflows-repaints-
css-performance-making-your-javascript-slow
● Repaint and reflow
https://dev.opera.com/articles/efficient-javascript/?page=3#reflow
● Rendering: repaint, reflow/relayout, restyle
http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/

Mais conteúdo relacionado

Destaque

Destaque (19)

React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
 
ReactNativeを語る勉強会
ReactNativeを語る勉強会ReactNativeを語る勉強会
ReactNativeを語る勉強会
 
Pjax 深入淺出
Pjax 深入淺出Pjax 深入淺出
Pjax 深入淺出
 
React
ReactReact
React
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - Workshop
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps.
 
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
 
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
 
DOM Features You Didn’t Know Existed
DOM Features You Didn’t Know ExistedDOM Features You Didn’t Know Existed
DOM Features You Didn’t Know Existed
 
Effective ES6
Effective ES6Effective ES6
Effective ES6
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
React JS and why it's awesome
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
 
React js
React jsReact js
React js
 

Semelhante a Repaint & reflow

Design Best Practices for WordPress
Design Best Practices for WordPressDesign Best Practices for WordPress
Design Best Practices for WordPress
Suzette Franck
 
Rapid Prototyping & Axure RP
Rapid Prototyping & Axure RPRapid Prototyping & Axure RP
Rapid Prototyping & Axure RP
ISsoft
 
E Portfolio Presentation
E Portfolio PresentationE Portfolio Presentation
E Portfolio Presentation
Dru Ryan
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
chomas kandar
 

Semelhante a Repaint & reflow (20)

Ustream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer ToolsUstream Techtalks: Google Chrome Developer Tools
Ustream Techtalks: Google Chrome Developer Tools
 
The Fast And The Fabulous
The Fast And The FabulousThe Fast And The Fabulous
The Fast And The Fabulous
 
Design Best Practices for WordPress
Design Best Practices for WordPressDesign Best Practices for WordPress
Design Best Practices for WordPress
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 20132013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
 
Rapid Prototyping & Axure RP
Rapid Prototyping & Axure RPRapid Prototyping & Axure RP
Rapid Prototyping & Axure RP
 
Advanced Layout Techniques @ CMSExpo
Advanced Layout Techniques @ CMSExpoAdvanced Layout Techniques @ CMSExpo
Advanced Layout Techniques @ CMSExpo
 
Proteus - android layout engine
Proteus - android layout engineProteus - android layout engine
Proteus - android layout engine
 
Developing Custom WordPress Themes for Clients
Developing Custom WordPress Themes for ClientsDeveloping Custom WordPress Themes for Clients
Developing Custom WordPress Themes for Clients
 
Tim Klein's talk on making websites with SilverStripe in no time
Tim Klein's talk on making websites with SilverStripe in no timeTim Klein's talk on making websites with SilverStripe in no time
Tim Klein's talk on making websites with SilverStripe in no time
 
Browsers. Magic is inside.
Browsers. Magic is inside.Browsers. Magic is inside.
Browsers. Magic is inside.
 
Let's Build a Custom Theme
Let's Build a Custom ThemeLet's Build a Custom Theme
Let's Build a Custom Theme
 
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
CascadingStyleSheets  in ONESHOT By DeathCodeYT .pdfCascadingStyleSheets  in ONESHOT By DeathCodeYT .pdf
CascadingStyleSheets in ONESHOT By DeathCodeYT .pdf
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 
Build your Own Customizable 3D Objects with Sculpteo
Build your Own Customizable 3D Objects with SculpteoBuild your Own Customizable 3D Objects with Sculpteo
Build your Own Customizable 3D Objects with Sculpteo
 
Enhancing Design with Adaptive Content
Enhancing Design with Adaptive ContentEnhancing Design with Adaptive Content
Enhancing Design with Adaptive Content
 
E Portfolio Presentation
E Portfolio PresentationE Portfolio Presentation
E Portfolio Presentation
 
Webapp Rendering and Optimization.
Webapp Rendering and Optimization.Webapp Rendering and Optimization.
Webapp Rendering and Optimization.
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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...
 
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)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Repaint & reflow