出版時間:2009年12月 出版社:東南大學(xué)出版社 作者:Steve Souders 頁數(shù):231
Tag標(biāo)簽:無
前言
Vigilant: alertly watchful, especially to avoid dangerAnyone browsing this book——or its predecessor, High Performance Web Sites——under-stands the dangers of a slow web site: frustrated users, negative brand perception,increased operating expenses, and loss of revenue. We have to constantly work to makeour web sites faster. As we make progress, we also lose ground. We have to be alert forthe impact of each bug fix, new feature, and system upgrade on our web site's speed.We have to be watchful, or the performance improvements made today can easily belost tomorrow. We have to be vigilant.Vigil: watch kept on a festival eveAccording to the Latin root of vigil, our watch ends with celebration. Web sites canindeed be faster——dramatically so——and we can celebrate the outcome of our care andattention. It's true! Making web sites faster is attainable. Some of the world's mostpopular web sites have reduced their load times by 60% using the techniques describedin this book. Smaller web properties benefit as well. Ultimately, users benefit.Vigilante: a self-appointed doer of justiceIt's up to us as developers to guard our users' interests. At your site, evangelize performance. Implement these techniques. Share this book with a coworker. Fight for afaster user experience. If your company doesn't have someone focused on performance,appoint yourself to that role. Performance vigilante——I like the sound of that.
內(nèi)容概要
《更快速網(wǎng)站(影印版)》內(nèi)容簡介:對于任何成功的網(wǎng)站來說,性能是至關(guān)重要的。但伴隨著不斷增長的豐富內(nèi)容和Ajax的過度使用,如今的Web應(yīng)用已經(jīng)將瀏覽器推至性能極限。在《更快速網(wǎng)站(影印版)》中,Google的Web性能專家和前任雅虎首席網(wǎng)站性能官Steve Souders提供了寶貴的技術(shù),來幫助你優(yōu)化網(wǎng)站性能。作者的上一《更快速網(wǎng)站(影印版)》是非常暢銷的《High Performance Web Sites》,它透露了80%的網(wǎng)頁加載時間是花在客戶端,使網(wǎng)絡(luò)開發(fā)世界為之震驚。在《更快速網(wǎng)站(影印版)》中,Souders和8位專家撰稿人提供了最佳實(shí)踐和實(shí)用建議,用于在三個范疇提高網(wǎng)站的性能:JavaScript——獲取用于了解Ajax性能的建議,編寫有效的JavaScript,創(chuàng)建響應(yīng)程序,加載腳本時不阻止其他組件等等。Network——學(xué)習(xí)穿過多個域共享資源,減小圖片尺寸而不損失質(zhì)量,以及使用分塊編碼(chunked encoding)來更快呈現(xiàn)頁面。Browser——探索內(nèi)嵌框架(iframe)的替代方案、如何簡化CSS選擇器和其他技術(shù)。對于當(dāng)今的富媒體網(wǎng)站和Web 2.0應(yīng)用來說,速度是至關(guān)重要的。有了這《更快速網(wǎng)站(影印版)》,你將學(xué)習(xí)到如何減少你的網(wǎng)站的加載時間,讓它們響應(yīng)得更快。
作者簡介
Steve Souders,在Google從事網(wǎng)絡(luò)性能和開放源碼計劃方面的工作。他是YSlow(Firebug性能分析擴(kuò)展)的創(chuàng)造者,并且擔(dān)任Velocity(0’Reilly的網(wǎng)絡(luò)性能和業(yè)務(wù)運(yùn)營會議)的聯(lián)合主席。Steve經(jīng)常在會議上或者高級別公司中發(fā)言,包括微軟、亞馬遜、MySpace、Linkedln、Facebook。
書籍目錄
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 Bad Threading Ensuring Responsiveness Web Workers Gears Timers Effects of Memory Use on Response Time Virtual Memory Troubleshooting Memory Issues Summary 3. Splitting the Initial Payload Kitchen Sink Savings from Splitting Finding the Split Undefined Symbols and Race Conditions Case Study: Google Calendar 4. Loading Scripts Without Blocking Scripts Block Making Scripts Play Nice XHR Eval XHR Injection Script in Iframe Script DOM Element Script Defer document.write Script Tag Browser Busy Indicators Ensuring (or Avoiding) Ordered Execution Summarizing the Results And the Winner Is 5. Coupling Asynchronous Scripts Code Example: menu.js Race Conditions Preserving Order Asynchronously Technique 1: Hardcoded Callback Technique 2: Window Onload Technique 3: Timer Technique 4: Script Onload Technique 5: Degrading Script Tags Multiple External Scripts Managed XHR DOM Element and Doc Write General Solution Single Script Multiple Scripts Asynchronicity in the Real World Google Analytics and Dojo YUI Loader Utility 6. Positioning Inline Scripts Inline Scripts Block Move Inline Scripts to the Bottom Initiate Execution Asynchronously Use Script Defer Preserving CSS and JavaScript Order Danger: Stylesheet Followed by Inline Script Inline Scripts Aren’t Blocked by Most Downloads Inline Scripts Are Blocked by Stylesheets This Does Happen 7. Writing Efficient JavaScript Managing Scope Use Local Variables Scope Chain Augmentation Efficient Data Access Flow Control Fast Conditionals Fast Loops String Optimization String Concatenation Trimming Strings Avoid Long-Running Scripts Yielding Using Timers Timer Patterns for Yielding Summary 8. Scaling with Comet How Comet Works Transport Techniques Polling Long Polling Forever Frame XHR Streaming Future Transports Cross-Domain Effects of Implementation on Applications Managing Connections Measuring Performance Protocols Summary 9. Going Beyond Gzipping Why Does This Matter? What Causes This? Quick Review The Culprit Examples of Popular Turtle Tappers How to Help These Users? Design to Minimize Uncompressed Size Educate Users Direct Detection of Gzip Support 10. Optimizing Images Two Steps to Simplify Image Optimization Image Formats Background Characteristics of the Different Formats More About PNG Automated Lossless Image Optimization Crushing PNGs Stripping JPEG Metadata Converting GIF to PNG Optimizing GIF Animations Smush.it Progressive JPEGs for Large Images Alpha Transparency: Avoid AlphaImageLoader Effects of Alpha Transparency AlphaImageLoader Problems with AlphaImageLoader Progressively Enhanced PNG8 Alpha Transparency Optimizing Sprites ?ber-Sprite Versus Modular Sprite Highly Optimized CSS Sprites Other Image Optimizations Avoid Scaling Images Crush Generated Images Favicons Apple Touch Icon Summary 11. Sharding Dominant Domains Critical Path Who’s Sharding? Downgrading to HTTP/1.0 Rolling Out Sharding IP Address or Hostname How Many Domains How to Split Resources Newer Browsers 12. Flushing the Document Early Flush the Head Output Buffering Chunked Encoding Flushing and Gzip Other Intermediaries Domain Blocking During Flushing Browsers: The Last Hurdle Flushing Beyond PHP The Flush Checklist 13. Using Iframes Sparingly The Most Expensive DOM Element Iframes Block Onload Parallel Downloads with Iframes Script Before Iframe Stylesheet Before Iframe Stylesheet After Iframe Connections per Hostname Connection Sharing in Iframes Connection Sharing Across Tabs and Windows Summarizing the Cost of Iframes 14. 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-Elements The Key to Efficient CSS Selectors Rightmost First Writing Efficient CSS Selectors CSS Selector Performance Complex Selectors Impact Performance (Sometimes) CSS Selectors to Avoid Reflow Time Measuring CSS Selectors in the Real World Appendix: Performance Tools Index
章節(jié)摘錄
插圖:Refactoring the code can reduce its apparent complexity, making optimization andother transformations more likely to yield benefits. For example, adopting the YSlowrules can have a huge impact on the delivery time of web pages (see http://developer. yahoo.com/yslow/).Even so, it is difficult for web applications to get under the Inefficiency line because ofthe size and complexity of web pages. Web pages are big, heavy, multipart things. Pagereplacement comes with a significant cost. For applications where the differencebetween successive pages is relatively small, use of Ajax techniques can produce a significant improvement.Instead of requesting a replacement page as a result of a user action, a packet of datais sent to the server (usually encoded asJSON text) and the server responds with anotherpacket (also typically JSON-encoded) containing data. A JavaScript program uses thatdata to update the browser's display. The amount of data transferred is significantly.reduced, and the time between the user action and the visible feedback isalso significantly reduced. The amount of work that the server must do is reduced.The amount of work that the browser must do is reduced. The amount of work thatthe Ajax programmer must do, unfortunately, is likely to increase. That is one of thetrade-offs.The architecture of an Ajax application is significantly different from most other sortsof applications because it is divided between two systems. Getting the division of laborright is essential if the Ajax approach is to have a positive impact on performance. Thepackets should be as small as possible. The application should be constructed as aconversation between the browser and the server, in which the two halves communicatein a concise, expressive, shared language. Just-in-time data delivery allows the browserside of the application to keep n small, which tends to keep the loops fast.A common mistake in Ajax applications is to send all of the application's data to thebrowser. This reintroduces the latency problems that Ajax is supposed to avoid. It alsoenlarges the volume of data that must be handled in the browser, increasing n and againcompromising performance.
媒體關(guān)注與評論
“本書擁有最近最新的專業(yè)知識,能使你的網(wǎng)站飛速運(yùn)行。我喜歡這本書的編排,有許多主題,每一個都被該領(lǐng)域最受人尊敬的權(quán)威人士所探究。我的團(tuán)隊(duì)中的每個人都將擁有一本。” ——Bill Scott,Netflix公司UI上程總監(jiān)
編輯推薦
《更快速網(wǎng)站(影印版)》是由東南大學(xué)出版社出版的。
圖書封面
圖書標(biāo)簽Tags
無
評論、評分、閱讀與下載