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
fast support Canary build deliver new features in really short intervals Deep configuration possibilites Early experimental access Rendering / Memory Profiling tools Why Google Chrome?
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.
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 !
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 !
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
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:
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.
management system • We cannot manipulate • References global variables Object variable • Can reference other variables Scalar variable • number, boolean, etc
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
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
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
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