出版社:东南大学出版社
年代:2009
定价:42.0
对于任何成功的网站来说,性能是至关重要的。但伴随着不断增长的丰富内容和Ajax的过度使用,如今的Web应用已经将浏览器推至极限。在本书中,Google的网络性能传播者和前任雅虎首席网站性能官Steve Souders提供了宝贵的技术,来帮助你优化网站性能。
Credits Preface 1. Understanding Ajax Performance Trade-offs Principles of Optimization Ajax Browser Wow! JavaScript Summary 2. Creating Responsive Web Applications What Is Fast Enough? Measuring Latency When Latency Goes BadThreadingEnsuring Responsiveness Web Workers Gears Timers Effects of Memory Use on Response Time Virtual Memory Troubleshooting Memory IssuesSummary3. Splitting the Initial PayloadKitchen SinkSavings from SplittingFinding the SplitUndefined Symbols and Race ConditionsCase Study: Google Calendar4. Loading Scripts Without Blocking Scripts BlockMaking Scripts Play Nice XHR Eval XHR Injection Script in Iframe Script DOM Element Script Defer document.write Script TagBrowser Busy IndicatorsEnsuring (or Avoiding) Ordered ExecutionSummarizing the ResultsAnd the Winner Is5. Coupling Asynchronous Scripts Code Example: menu.jsRace ConditionsPreserving Order Asynchronously Technique 1: Hardcoded Callback Technique 2: Window Onload Technique 3: Timer Technique 4: Script Onload Technique 5: Degrading Script TagsMultiple External Scripts Managed XHR DOM Element and Doc WriteGeneral Solution Single Script Multiple ScriptsAsynchronicity in the Real World Google Analytics and Dojo YUI Loader Utility6. Positioning Inline Scripts Inline Scripts Block Move Inline Scripts to the Bottom Initiate Execution Asynchronously Use Script DeferPreserving CSS and JavaScript OrderDanger: Stylesheet Followed by Inline Script Inline Scripts Aren’t Blocked by Most Downloads Inline Scripts Are Blocked by Stylesheets This Does Happen7. Writing Efficient JavaScript Managing Scope Use Local Variables Scope Chain AugmentationEfficient Data AccessFlow Control Fast Conditionals Fast LoopsString Optimization String Concatenation Trimming StringsAvoid Long-Running Scripts Yielding Using Timers Timer Patterns for YieldingSummary8. Scaling with Comet How Comet WorksTransport Techniques Polling Long Polling Forever Frame XHR Streaming Future TransportsCross-DomainEffects of Implementation on Applications Managing Connections Measuring Performance ProtocolsSummary9. Going Beyond Gzipping Why Does This Matter?What Causes This? Quick Review The Culprit Examples of Popular Turtle TappersHow to Help These Users? Design to Minimize Uncompressed Size Educate Users Direct Detection of Gzip Support10. Optimizing Images Two Steps to Simplify Image OptimizationImage Formats Background Characteristics of the Different Formats More About PNGAutomated Lossless Image Optimization Crushing PNGs Stripping JPEG Metadata Converting GIF to PNG Optimizing GIF Animations Smush.it Progressive JPEGs for Large ImagesAlpha Transparency: Avoid AlphaImageLoader Effects of Alpha Transparency AlphaImageLoader Problems with AlphaImageLoader Progressively Enhanced PNG8 Alpha TransparencyOptimizing Sprites ?ber-Sprite Versus Modular Sprite Highly Optimized CSS SpritesOther Image Optimizations Avoid Scaling Images Crush Generated Images Favicons Apple Touch IconSummary11. Sharding Dominant DomainsCritical PathWho’s Sharding?Downgrading to HTTP/1.0Rolling Out Sharding IP Address or Hostname How Many Domains How to Split Resources Newer Browsers12. Flushing the Document EarlyFlush the HeadOutput BufferingChunked EncodingFlushing and GzipOther IntermediariesDomain Blocking During FlushingBrowsers: The Last HurdleFlushing Beyond PHPThe Flush Checklist13. Using Iframes SparinglyThe Most Expensive DOM ElementIframes Block OnloadParallel Downloads with Iframes Script Before Iframe Stylesheet Before Iframe Stylesheet After IframeConnections per Hostname Connection Sharing in Iframes Connection Sharing Across Tabs and WindowsSummarizing the Cost of Iframes14. Simplifying CSS Selectors Types of Selectors ID Selectors Class Selectors Type Selectors Adjacent Sibling Selectors Child Selectors Descendant Selectors Universal Selectors Attribute Selectors Pseudo-Classes and Pseudo-ElementsThe Key to Efficient CSS Selectors Rightmost First Writing Efficient CSS SelectorsCSS Selector Performance Complex Selectors Impact Performance (Sometimes) CSS Selectors to Avoid Reflow TimeMeasuring CSS Selectors in the Real WorldAppendix: Performance ToolsIndex