Patterns & Practices • A ReIntroduction to JavaScript Memory Leaks • Profiling JavaScript Applications • Practice Time: Step by Step Optimizing a Sample Application • Q&A Thursday, October 3, 13
Depth • Minimize DOM Repaints and Reflows (cache DOM calculations) • Keep Your Markup Clean (avoid inline & embedded code) • Purge Anything that is not Visible (from DOM AND from Memory) • Async Load Third-Party Widgets • Smoothness/Speed Tradeoff Thursday, October 3, 13
Make AJAX Cacheable • Use a Strict REST Architecture • Reduce Cookie Size • Use Cookie-Free Domains for Components • Make favicon.ico Small and Cacheable Thursday, October 3, 13
Tools) •Know Thy Frameworks • Live in TDD (jasmine, jshint, istanbul) • One Click Publish, Automation, and CI (git pre-commit hooks, grunt, jenkins) Thursday, October 3, 13
Memory Leaks in Older Browsers (read: Internet Explorer) • Memory Leaks Related to Timers • Memory Leaks Related to Debug Console • Size Does Matter • Structural Leaks Thursday, October 3, 13
Bugs • They Are the Most Common Leaks • Handlers, Registries, Controllers, Managers, Mediators,Observables Are Leaker Candidates • Leaks are in the Nature of Event-Based Architectures • Closures and Modules Are Controlled Memory Leaks • Good kids clean their mess! Thursday, October 3, 13