<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>프로그래밍로그</title>
    <link>https://epicdevsold.tistory.com/</link>
    <description></description>
    <language>ko</language>
    <pubDate>Sun, 26 Jul 2026 21:54:08 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>epicdev</managingEditor>
    <image>
      <title>프로그래밍로그</title>
      <url>https://t1.daumcdn.net/cfile/tistory/144EE8464E67214006</url>
      <link>https://epicdevsold.tistory.com</link>
    </image>
    <item>
      <title>블로그 이전합니다</title>
      <link>https://epicdevsold.tistory.com/181</link>
      <description>&lt;p&gt;기존의 제 블로그가 인터넷에 있는 자료들을 스크랩 및 짜깁기해서 글을 올리는 개인공간이 었다면&lt;/p&gt;&lt;p&gt;새로운 블로그는 제가 직접 컨텐츠를 창조하는 공간이 될 것 같습니다.&lt;/p&gt;&lt;p&gt;새로운 블로그는 제 취미인 디자인과 직업인 프로그래밍을 모두 다루는 블로그가 될 것 같습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;주소: &lt;a href=&quot;http://epicdevs.com&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://epicdevs.com&lt;/a&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/181</guid>
      <comments>https://epicdevsold.tistory.com/181#entry181comment</comments>
      <pubDate>Fri, 14 Jun 2013 00:09:05 +0900</pubDate>
    </item>
    <item>
      <title>SQL Server의 SELECT TOP과 동일한 쿼리들 (MySQL, Oracle, DB2)</title>
      <link>https://epicdevsold.tistory.com/180</link>
      <description>&lt;p&gt;SQL Server&lt;/p&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border: 1px solid rgb(219, 232, 251); background-color: rgb(219, 232, 251); padding: 10px;&quot;&gt;&lt;p&gt;&lt;span style=&quot;background-color: rgb(154, 165, 234);&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;SELECT TOP n&lt;/span&gt;&lt;/p&gt;&lt;p&gt;FROM table_name&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;MySQL&lt;/p&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border: 1px solid rgb(219, 232, 251); background-color: rgb(219, 232, 251); padding: 10px;&quot;&gt;&lt;p&gt;SELECT *&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;FROM table_name&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;LIMIT n&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Oracle&lt;/p&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border: 1px solid rgb(219, 232, 251); background-color: rgb(219, 232, 251); padding: 10px;&quot;&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;SELECT *&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;FROM table_name&lt;/span&gt;&lt;/p&gt;&lt;p&gt;WHERE ROWNUM &amp;lt;= number&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;DB2&lt;/p&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border: 1px solid rgb(219, 232, 251); background-color: rgb(219, 232, 251); padding: 10px;&quot;&gt;&lt;p&gt;SELECT *&lt;/p&gt;&lt;p&gt;from table_name&lt;/p&gt;&lt;p&gt;FETCH FIRST n ROWS ONLY&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>db</category>
      <category>DB2</category>
      <category>MySQL</category>
      <category>Oracle</category>
      <category>SELECT TOP</category>
      <category>SQL</category>
      <category>SQL Server</category>
      <category>오라클</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/180</guid>
      <comments>https://epicdevsold.tistory.com/180#entry180comment</comments>
      <pubDate>Sun, 26 May 2013 15:51:14 +0900</pubDate>
    </item>
    <item>
      <title>웹페이지의 속도를 올리는 방법 (원제: Best Practices for Speeding Up Your Web Site)</title>
      <link>https://epicdevsold.tistory.com/179</link>
      <description>&lt;p&gt;출처:&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html&quot; style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;http://developer.yahoo.com/performance/rules.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;아직은 대형 사이트를 개발해본 경험이 없기 때문에 나에게 와 닿거나, 신기했던 내용들을 요약하자면 아래의 7개 항목들 정도.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1. Minimize HTTP Requests&lt;/p&gt;&lt;p&gt;2.&amp;nbsp;Put Scripts at the Bottom&lt;/p&gt;&lt;p&gt;3.&amp;nbsp;Make JavaScript and CSS External&lt;/p&gt;&lt;p&gt;4. Use GET for AJAX Requests&lt;/p&gt;&lt;p&gt;5.&amp;nbsp;Minimize DOM Access&lt;/p&gt;&lt;p&gt;6.&amp;nbsp;Develop Smart Event Handlers&lt;/p&gt;&lt;p&gt;7. Avoid Empty Image src&lt;/p&gt;&lt;h3 id=&quot;num_http&quot; style=&quot;margin-top: 1em; margin-right: 0px; margin-bottom: 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Minimize HTTP Requests&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One way to reduce the number of components in the page is to simplify the page's design. But is there a way to build pages with richer content while also achieving fast response times? Here are some techniques for reducing the number of HTTP requests, while still supporting rich page designs.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;strong&gt;Combined files&lt;/strong&gt;&amp;nbsp;are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://alistapart.com/articles/sprites&quot; data-rapid_p=&quot;1&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&lt;strong&gt;CSS Sprites&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;are the preferred method for reducing the number of image requests. Combine your background images into a single image and use the CSS&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;background-image&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;background-position&lt;/code&gt;properties to display the desired image segment.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/struct/objects.html#h-13.6&quot; data-rapid_p=&quot;2&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&lt;strong&gt;Image maps&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;combine multiple images into a single image. The overall size is about the same, but reducing the number of HTTP requests speeds up the page. Image maps only work if the images are contiguous in the page, such as a navigation bar. Defining the coordinates of image maps can be tedious and error prone. Using image maps for navigation is not accessible too, so it's not recommended.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;strong&gt;Inline images&lt;/strong&gt;&amp;nbsp;use the&amp;nbsp;&lt;a href=&quot;http://tools.ietf.org/html/rfc2397&quot; data-rapid_p=&quot;3&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;data:&lt;/code&gt;&amp;nbsp;URL scheme&lt;/a&gt;&amp;nbsp;to embed the image data in the actual page. This can increase the size of your HTML document. Combining inline images into your (cached) stylesheets is a way to reduce HTTP requests and avoid increasing the size of your pages. Inline images are not yet supported across all major browsers.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Reducing the number of HTTP requests in your page is the place to start. This is the most important guideline for improving performance for first time visitors. As described in Tenni Theurer's blog post&amp;nbsp;&lt;a href=&quot;http://yuiblog.com/blog/2007/01/04/performance-research-part-2/&quot; data-rapid_p=&quot;4&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Browser Cache Usage - Exposed!&lt;/a&gt;, 40-60% of daily visitors to your site come in with an empty cache. Making your page fast for these first time visitors is key to a better user experience.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;5&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html&quot; data-rapid_p=&quot;6&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;cdn&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Use a Content Delivery Network&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The user's proximity to your web server has an impact on response times. Deploying your content across multiple, geographically dispersed servers will make your pages load faster from the user's perspective. But where should you start?&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;As a first step to implementing geographically dispersed content, don't attempt to redesign your web application to work in a distributed architecture. Depending on the application, changing the architecture could include daunting tasks such as synchronizing session state and replicating database transactions across server locations. Attempts to reduce the distance between users and your content could be delayed by, or never pass, this application architecture step.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Remember that 80-90% of the end-user response time is spent downloading all the components in the page: images, stylesheets, scripts, Flash, etc. This is the&amp;nbsp;&lt;em&gt;Performance Golden Rule&lt;/em&gt;. Rather than starting with the difficult task of redesigning your application architecture, it's better to first disperse your static content. This not only achieves a bigger reduction in response times, but it's easier thanks to content delivery networks.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. The server selected for delivering content to a specific user is typically based on a measure of network proximity. For example, the server with the fewest network hops or the server with the quickest response time is chosen.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Some large Internet companies own their own CDN, but it's cost-effective to use a CDN service provider, such as&amp;nbsp;&lt;a href=&quot;http://www.akamai.com/&quot; data-rapid_p=&quot;7&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Akamai Technologies&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.edgecast.com/&quot; data-rapid_p=&quot;8&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;EdgeCast&lt;/a&gt;, or&amp;nbsp;&lt;a href=&quot;http://www.level3.com/index.cfm?pageID=36&quot; data-rapid_p=&quot;9&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;level3&lt;/a&gt;. For start-up companies and private web sites, the cost of a CDN service can be prohibitive, but as your target audience grows larger and becomes more global, a CDN is necessary to achieve fast response times. At Yahoo!, properties that moved static content off their application web servers to a CDN (both 3rd party as mentioned above as well as Yahoo’s own&amp;nbsp;&lt;a href=&quot;https://cwiki.apache.org/TS/traffic-server.html&quot; data-rapid_p=&quot;10&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;CDN&lt;/a&gt;) improved end-user response times by 20% or more. Switching to a CDN is a relatively easy code change that will dramatically improve the speed of your web site.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;11&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/04/high_performanc_1.html&quot; data-rapid_p=&quot;12&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;expires&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Add an Expires or a Cache-Control Header&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;There are two aspects to this rule:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;For static components: implement &quot;Never expire&quot; policy by setting far future&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Expires&lt;/code&gt;&amp;nbsp;header&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;For dynamic components: use an appropriate&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Cache-Control&lt;/code&gt;&amp;nbsp;header to help the browser with conditional requests&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Web page designs are getting richer and richer, which means more scripts, stylesheets, images, and Flash in the page. A first-time visitor to your page may have to make several HTTP requests, but by using the Expires header you make those components cacheable. This avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often used with images, but they should be used on&amp;nbsp;&lt;em&gt;all&lt;/em&gt;&amp;nbsp;components including scripts, stylesheets, and Flash components.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Browsers (and proxies) use a cache to reduce the number and size of HTTP requests, making web pages load faster. A web server uses the Expires header in the HTTP response to tell the client how long a component can be cached. This is a far future Expires header, telling the browser that this response won't be stale until April 15, 2010.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      Expires: Thu, 15 Apr 2010 20:00:00 GMT&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;If your server is Apache, use the ExpiresDefault directive to set an expiration date relative to the current date. This example of the ExpiresDefault directive sets the Expires date 10 years out from the time of the request.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      ExpiresDefault &quot;access plus 10 years&quot;&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the component changes. At Yahoo! we often make this step part of the build process: a version number is embedded in the component's filename, for example, yahoo_2.0.6.js.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Using a far future Expires header affects page views only after a user has already visited your site. It has no effect on the number of HTTP requests when a user visits your site for the first time and the browser's cache is empty. Therefore the impact of this performance improvement depends on how often users hit your pages with a primed cache. (A &quot;primed cache&quot; already contains all of the components in the page.) We&lt;a href=&quot;http://yuiblog.com/blog/2007/01/04/performance-research-part-2/&quot; data-rapid_p=&quot;13&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;measured this at Yahoo!&lt;/a&gt;&amp;nbsp;and found the number of page views with a primed cache is 75-85%. By using a far future Expires header, you increase the number of components that are cached by the browser and re-used on subsequent page views without sending a single byte over the user's Internet connection.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;14&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/05/high_performanc_2.html&quot; data-rapid_p=&quot;15&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;gzip&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Gzip Components&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The time it takes to transfer an HTTP request and response across the network can be significantly reduced by decisions made by front-end engineers. It's true that the end-user's bandwidth speed, Internet service provider, proximity to peering exchange points, etc. are beyond the control of the development team. But there are other variables that affect response times. Compression reduces response times by reducing the size of the HTTP response.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Starting with HTTP/1.1, web clients indicate support for compression with the Accept-Encoding header in the HTTP request.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      Accept-Encoding: gzip, deflate&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;If the web server sees this header in the request, it may compress the response using one of the methods listed by the client. The web server notifies the web client of this via the Content-Encoding header in the response.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      Content-Encoding: gzip&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Gzip is the most popular and effective compression method at this time. It was developed by the GNU project and standardized by&amp;nbsp;&lt;a href=&quot;http://www.ietf.org/rfc/rfc1952.txt&quot; data-rapid_p=&quot;16&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;RFC 1952&lt;/a&gt;. The only other compression format you're likely to see is deflate, but it's less effective and less popular.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Gzipping generally reduces the response size by about 70%. Approximately 90% of today's Internet traffic travels through browsers that claim to support gzip. If you use Apache, the module configuring gzip depends on your version: Apache 1.3 uses&amp;nbsp;&lt;a href=&quot;http://sourceforge.net/projects/mod-gzip/&quot; data-rapid_p=&quot;17&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;mod_gzip&lt;/a&gt;&amp;nbsp;while Apache 2.x uses&amp;nbsp;&lt;a href=&quot;http://httpd.apache.org/docs/2.0/mod/mod_deflate.html&quot; data-rapid_p=&quot;18&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;mod_deflate&lt;/a&gt;.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;There are known issues with browsers and proxies that may cause a mismatch in what the browser expects and what it receives with regard to compressed content. Fortunately, these edge cases are dwindling as the use of older browsers drops off. The Apache modules help out by adding appropriate Vary response headers automatically.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Servers choose what to gzip based on file type, but are typically too limited in what they decide to compress. Most web sites gzip their HTML documents. It's also worthwhile to gzip your scripts and stylesheets, but many web sites miss this opportunity. In fact, it's worthwhile to compress any text response including XML and JSON. Image and PDF files should not be gzipped because they are already compressed. Trying to gzip them not only wastes CPU but can potentially increase file sizes.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Gzipping as many file types as possible is an easy way to reduce page weight and accelerate the user experience.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;19&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_3.html&quot; data-rapid_p=&quot;20&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;css_top&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Put Stylesheets at the Top&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;While researching performance at Yahoo!, we discovered that moving stylesheets to the document HEAD makes pages&amp;nbsp;&lt;em&gt;appear&lt;/em&gt;&amp;nbsp;to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Front-end engineers that care about performance want a page to load progressively; that is, we want the browser to display whatever content it has as soon as possible. This is especially important for pages with a lot of content and for users on slower Internet connections. The importance of giving users visual feedback, such as progress indicators, has been well researched and&amp;nbsp;&lt;a href=&quot;http://www.useit.com/papers/responsetime.html&quot; data-rapid_p=&quot;21&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;documented&lt;/a&gt;. In our case the HTML page is the progress indicator! When the browser loads the page progressively the header, the navigation bar, the logo at the top, etc. all serve as visual feedback for the user who is waiting for the page. This improves the overall user experience.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The problem with putting stylesheets near the bottom of the document is that it prohibits progressive rendering in many browsers, including Internet Explorer. These browsers block rendering to avoid having to redraw elements of the page if their styles change. The user is stuck viewing a blank white page.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The&amp;nbsp;&lt;a href=&quot;http://www.w3.org/TR/html4/struct/links.html#h-12.3&quot; data-rapid_p=&quot;22&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;HTML specification&lt;/a&gt;&amp;nbsp;clearly states that stylesheets are to be included in the HEAD of the page: &quot;Unlike A, [LINK] may only appear in the HEAD section of a document, although it may appear any number of times.&quot; Neither of the alternatives, the blank white screen or flash of unstyled content, are worth the risk. The optimal solution is to follow the HTML specification and load your stylesheets in the document HEAD.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;23&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_4.html&quot; data-rapid_p=&quot;24&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;js_bottom&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Put Scripts at the Bottom&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The problem caused by scripts is that they block parallel downloads. The&amp;nbsp;&lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4&quot; data-rapid_p=&quot;25&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;HTTP/1.1 specification&lt;/a&gt;&amp;nbsp;suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;In some situations it's not easy to move scripts to the bottom. If, for example, the script uses&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;document.write&lt;/code&gt;&amp;nbsp;to insert part of the page's content, it can't be moved lower in the page. There might also be scoping issues. In many cases, there are ways to workaround these situations.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;An alternative suggestion that often comes up is to use deferred scripts. The&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;DEFER&lt;/code&gt;&amp;nbsp;attribute indicates that the script does not contain document.write, and is a clue to browsers that they can continue rendering. Unfortunately, Firefox doesn't support the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;DEFER&lt;/code&gt;&amp;nbsp;attribute. In Internet Explorer, the script may be deferred, but not as much as desired. If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;26&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_5.html&quot; data-rapid_p=&quot;27&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;css_expressions&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Avoid CSS Expressions&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;CSS expressions are a powerful (and dangerous) way to set CSS properties dynamically. They were supported in Internet Explorer starting with version 5, but were&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms537634%28VS.85%29.aspx&quot; data-rapid_p=&quot;28&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;deprecated starting with IE8&lt;/a&gt;. As an example, the background color could be set to alternate every hour using CSS expressions:&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      background-color: expression( (new Date()).getHours()%2 ? &quot;#B8D4FF&quot; : &quot;#F08A00&quot; );&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;As shown here, the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;expression&lt;/code&gt;&amp;nbsp;method accepts a JavaScript expression. The CSS property is set to the result of evaluating the JavaScript expression. The&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;expression&lt;/code&gt;&amp;nbsp;method is ignored by other browsers, so it is useful for setting properties in Internet Explorer needed to create a consistent experience across browsers.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The problem with expressions is that they are evaluated more frequently than most people expect. Not only are they evaluated when the page is rendered and resized, but also when the page is scrolled and even when the user moves the mouse over the page. Adding a counter to the CSS expression allows us to keep track of when and how often a CSS expression is evaluated. Moving the mouse around the page can easily generate more than 10,000 evaluations.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One way to reduce the number of times your CSS expression is evaluated is to use one-time expressions, where the first time the expression is evaluated it sets the style property to an explicit value, which replaces the CSS expression. If the style property must be set dynamically throughout the life of the page, using event handlers instead of CSS expressions is an alternative approach. If you must use CSS expressions, remember that they may be evaluated thousands of times and could affect the performance of your page.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;29&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_6.html&quot; data-rapid_p=&quot;30&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;external&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Make JavaScript and CSS External&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript, css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Many of these performance rules deal with how external components are managed. However, before these considerations arise you should ask a more basic question: Should JavaScript and CSS be contained in external files, or inlined in the page itself?&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Using external files in the real world generally produces faster pages because the JavaScript and CSS files are cached by the browser. JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. On the other hand, if the JavaScript and CSS are in external files cached by the browser, the size of the HTML document is reduced without increasing the number of HTTP requests.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The key factor, then, is the frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested. This factor, although difficult to quantify, can be gauged using various metrics. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets, there is a greater potential benefit from cached external files.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Many web sites fall in the middle of these metrics. For these sites, the best solution generally is to deploy the JavaScript and CSS as external files. The only exception where inlining is preferable is with home pages, such as&amp;nbsp;&lt;a href=&quot;http://www.yahoo.com/&quot; data-rapid_p=&quot;31&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Yahoo!'s front page&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://my.yahoo.com/&quot; data-rapid_p=&quot;32&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;My Yahoo!&lt;/a&gt;. Home pages that have few (perhaps only one) page view per session may find that inlining JavaScript and CSS results in faster end-user response times.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For front pages that are typically the first of many page views, there are techniques that leverage the reduction of HTTP requests that inlining provides, as well as the caching benefits achieved through using external files. One such technique is to inline JavaScript and CSS in the front page, but dynamically download the external files after the page has finished loading. Subsequent pages would reference the external files that should already be in the browser's cache.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;33&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/rule_8_make_jav.html&quot; data-rapid_p=&quot;34&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;dns_lookups&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Reduce DNS Lookups&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The Domain Name System (DNS) maps hostnames to IP addresses, just as phonebooks map people's names to their phone numbers. When you type www.yahoo.com into your browser, a DNS resolver contacted by the browser returns that server's IP address. DNS has a cost. It typically takes 20-120 milliseconds for DNS to lookup the IP address for a given hostname. The browser can't download anything from this hostname until the DNS lookup is completed.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;DNS lookups are cached for better performance. This caching can occur on a special caching server, maintained by the user's ISP or local area network, but there is also caching that occurs on the individual user's computer. The DNS information remains in the operating system's DNS cache (the &quot;DNS Client service&quot; on Microsoft Windows). Most browsers have their own caches, separate from the operating system's cache. As long as the browser keeps a DNS record in its own cache, it doesn't bother the operating system with a request for the record.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Internet Explorer caches DNS lookups for 30 minutes by default, as specified by the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;DnsCacheTimeout&lt;/code&gt;registry setting. Firefox caches DNS lookups for 1 minute, controlled by the&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;network.dnsCacheExpiration&lt;/code&gt;&amp;nbsp;configuration setting. (Fasterfox changes this to 1 hour.)&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;When the client's DNS cache is empty (for both the browser and the operating system), the number of DNS lookups is equal to the number of unique hostnames in the web page. This includes the hostnames used in the page's URL, images, script files, stylesheets, Flash objects, etc. Reducing the number of unique hostnames reduces the number of DNS lookups.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Reducing the number of unique hostnames has the potential to reduce the amount of parallel downloading that takes place in the page. Avoiding DNS lookups cuts response times, but reducing parallel downloads may increase response times. My guideline is to split these components across at least two but no more than four hostnames. This results in a good compromise between reducing DNS lookups and allowing a high degree of parallel downloads.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;35&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_7.html&quot; data-rapid_p=&quot;36&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;minify&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Minify JavaScript and CSS&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript, css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced. Two popular tools for minifying JavaScript code are&amp;nbsp;&lt;a href=&quot;http://crockford.com/javascript/jsmin&quot; data-rapid_p=&quot;37&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;JSMin&lt;/a&gt;and&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/yui/compressor/&quot; data-rapid_p=&quot;38&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;YUI Compressor&lt;/a&gt;. The YUI compressor can also minify CSS.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Obfuscation is an alternative optimization that can be applied to source code. It's more complex than minification and thus more likely to generate bugs as a result of the obfuscation step itself. In a survey of ten top U.S. web sites, minification achieved a 21% size reduction versus 25% for obfuscation. Although obfuscation has a higher size reduction, minifying JavaScript is less risky.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;In addition to minifying external scripts and styles, inlined&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;style&amp;gt;&lt;/code&gt;&amp;nbsp;blocks can and should also be minified. Even if you gzip your scripts and styles, minifying them will still reduce the size by 5% or more. As the use and size of JavaScript and CSS increases, so will the savings gained by minifying your code.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;39&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_8.html&quot; data-rapid_p=&quot;40&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;redirects&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Avoid Redirects&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Redirects are accomplished using the 301 and 302 status codes. Here's an example of the HTTP headers in a 301 response:&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      HTTP/1.1 301 Moved Permanently
      Location: http://example.com/newuri
      Content-Type: text/html&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The browser automatically takes the user to the URL specified in the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Location&lt;/code&gt;&amp;nbsp;field. All the information necessary for a redirect is in the headers. The body of the response is typically empty. Despite their names, neither a 301 nor a 302 response is cached in practice unless additional headers, such as&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Expires&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Cache-Control&lt;/code&gt;, indicate it should be. The meta refresh tag and JavaScript are other ways to direct users to a different URL, but if you must do a redirect, the preferred technique is to use the standard 3xx HTTP status codes, primarily to ensure the back button works correctly.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The main thing to remember is that redirects slow down the user experience. Inserting a redirect between the user and the HTML document delays everything in the page since nothing in the page can be rendered and no components can start being downloaded until the HTML document has arrived.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One of the most wasteful redirects happens frequently and web developers are generally not aware of it. It occurs when a trailing slash (/) is missing from a URL that should otherwise have one. For example, going to&lt;a href=&quot;http://astrology.yahoo.com/astrology&quot; data-rapid_p=&quot;41&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;http://astrology.yahoo.com/astrology&lt;/a&gt;&amp;nbsp;results in a 301 response containing a redirect to&lt;a href=&quot;http://astrology.yahoo.com/astrology/&quot; data-rapid_p=&quot;42&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;http://astrology.yahoo.com/astrology/&lt;/a&gt;&amp;nbsp;(notice the added trailing slash). This is fixed in Apache by using&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Alias&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;mod_rewrite&lt;/code&gt;, or the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;DirectorySlash&lt;/code&gt;&amp;nbsp;directive if you're using Apache handlers.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Connecting an old web site to a new one is another common use for redirects. Others include connecting different parts of a website and directing the user based on certain conditions (type of browser, type of user account, etc.). Using a redirect to connect two web sites is simple and requires little additional coding. Although using redirects in these situations reduces the complexity for developers, it degrades the user experience. Alternatives for this use of redirects include using&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Alias&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;mod_rewrite&lt;/code&gt;&amp;nbsp;if the two code paths are hosted on the same server. If a domain name change is the cause of using redirects, an alternative is to create a CNAME (a DNS record that creates an alias pointing from one domain name to another) in combination with&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Alias&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;mod_rewrite&lt;/code&gt;.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;43&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_9.html&quot; data-rapid_p=&quot;44&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;js_dupes&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Remove Duplicate Scripts&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;It hurts performance to include the same JavaScript file twice in one page. This isn't as unusual as you might think. A review of the ten top U.S. web sites shows that two of them contain a duplicated script. Two main factors increase the odds of a script being duplicated in a single web page: team size and number of scripts. When it does happen, duplicate scripts hurt performance by creating unnecessary HTTP requests and wasted JavaScript execution.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Unnecessary HTTP requests happen in Internet Explorer, but not in Firefox. In Internet Explorer, if an external script is included twice and is not cacheable, it generates two HTTP requests during page loading. Even if the script is cacheable, extra HTTP requests occur when the user reloads the page.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;In addition to generating wasteful HTTP requests, time is wasted evaluating the script multiple times. This redundant JavaScript execution happens in both Firefox and Internet Explorer, regardless of whether the script is cacheable.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One way to avoid accidentally including the same script twice is to implement a script management module in your templating system. The typical way to include a script is to use the SCRIPT tag in your HTML page.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      &amp;lt;script type=&quot;text/javascript&quot; src=&quot;menu_1.0.17.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;An alternative in PHP would be to create a function called&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;insertScript&lt;/code&gt;.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      &amp;lt;?php insertScript(&quot;menu.js&quot;) ?&amp;gt;&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;In addition to preventing the same script from being inserted multiple times, this function could handle other issues with scripts, such as dependency checking and adding version numbers to script filenames to support far future Expires headers.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;45&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_10.html&quot; data-rapid_p=&quot;46&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;etags&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Configure ETags&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Entity tags (ETags) are a mechanism that web servers and browsers use to determine whether the component in the browser's cache matches the one on the origin server. (An &quot;entity&quot; is another word a &quot;component&quot;: images, scripts, stylesheets, etc.) ETags were added to provide a mechanism for validating entities that is more flexible than the last-modified date. An ETag is a string that uniquely identifies a specific version of a component. The only format constraints are that the string be quoted. The origin server specifies the component's ETag using the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;ETag&lt;/code&gt;&amp;nbsp;response header.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      HTTP/1.1 200 OK
      Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT
      ETag: &quot;10c24bc-4ab-457e1c1f&quot;
      Content-Length: 12195&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Later, if the browser has to validate a component, it uses the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;If-None-Match&lt;/code&gt;&amp;nbsp;header to pass the ETag back to the origin server. If the ETags match, a 304 status code is returned reducing the response by 12195 bytes for this example.&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      GET /i/yahoo.gif HTTP/1.1
      Host: us.yimg.com
      If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT
      If-None-Match: &quot;10c24bc-4ab-457e1c1f&quot;
      HTTP/1.1 304 Not Modified&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The problem with ETags is that they typically are constructed using attributes that make them unique to a specific server hosting a site. ETags won't match when a browser gets the original component from one server and later tries to validate that component on a different server, a situation that is all too common on Web sites that use a cluster of servers to handle requests. By default, both Apache and IIS embed data in the ETag that dramatically reduces the odds of the validity test succeeding on web sites with multiple servers.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The ETag format for Apache 1.3 and 2.x is&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;inode-size-timestamp&lt;/code&gt;. Although a given file may reside in the same directory across multiple servers, and have the same file size, permissions, timestamp, etc., its inode is different from one server to the next.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;IIS 5.0 and 6.0 have a similar issue with ETags. The format for ETags on IIS is&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Filetimestamp:ChangeNumber&lt;/code&gt;. A&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;ChangeNumber&lt;/code&gt;&amp;nbsp;is a counter used to track configuration changes to IIS. It's unlikely that the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;ChangeNumber&lt;/code&gt;&amp;nbsp;is the same across all IIS servers behind a web site.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The end result is ETags generated by Apache and IIS for the exact same component won't match from one server to another. If the ETags don't match, the user doesn't receive the small, fast 304 response that ETags were designed for; instead, they'll get a normal 200 response along with all the data for the component. If you host your web site on just one server, this isn't a problem. But if you have multiple servers hosting your web site, and you're using Apache or IIS with the default ETag configuration, your users are getting slower pages, your servers have a higher load, you're consuming greater bandwidth, and proxies aren't caching your content efficiently. Even if your components have a far future&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Expires&lt;/code&gt;&amp;nbsp;header, a conditional GET request is still made whenever the user hits Reload or Refresh.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;If you're not taking advantage of the flexible validation model that ETags provide, it's better to just remove the ETag altogether. The&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;Last-Modified&lt;/code&gt;&amp;nbsp;header validates based on the component's timestamp. And removing the ETag reduces the size of the HTTP headers in both the response and subsequent requests. This&lt;a href=&quot;http://support.microsoft.com/?id=922733&quot; data-rapid_p=&quot;47&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Microsoft Support article&lt;/a&gt;&amp;nbsp;describes how to remove ETags. In Apache, this is done by simply adding the following line to your Apache configuration file:&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      FileETag none&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;48&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/07/high_performanc_11.html&quot; data-rapid_p=&quot;49&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;cacheajax&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Make Ajax Cacheable&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One of the cited benefits of Ajax is that it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using Ajax is no guarantee that the user won't be twiddling his thumbs waiting for those asynchronous JavaScript and XML responses to return. In many applications, whether or not the user is kept waiting depends on how Ajax is used. For example, in a web-based email client the user will be kept waiting for the results of an Ajax request to find all the email messages that match their search criteria. It's important to remember that &quot;asynchronous&quot; does not imply &quot;instantaneous&quot;.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;To improve performance, it's important to optimize these Ajax responses. The most important way to improve the performance of Ajax is to make the responses cacheable, as discussed in&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#expires&quot; data-rapid_p=&quot;50&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Add an Expires or a Cache-Control Header&lt;/a&gt;. Some of the other rules also apply to Ajax:&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#gzip&quot; data-rapid_p=&quot;51&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Gzip Components&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#dns_lookups&quot; data-rapid_p=&quot;52&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Reduce DNS Lookups&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#minify&quot; data-rapid_p=&quot;53&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Minify JavaScript&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#redirects&quot; data-rapid_p=&quot;54&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Avoid Redirects&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#etags&quot; data-rapid_p=&quot;55&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Configure ETags&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Let's look at an example. A Web 2.0 email client might use Ajax to download the user's address book for autocompletion. If the user hasn't modified her address book since the last time she used the email web app, the previous address book response could be read from cache if that Ajax response was made cacheable with a future Expires or Cache-Control header. The browser must be informed when to use a previously cached address book response versus requesting a new one. This could be done by adding a timestamp to the address book Ajax URL indicating the last time the user modified her address book, for example,&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;amp;t=1190241612&lt;/code&gt;. If the address book hasn't been modified since the last download, the timestamp will be the same and the address book will be read from the browser's cache eliminating an extra HTTP roundtrip. If the user has modified her address book, the timestamp ensures the new URL doesn't match the cached response, and the browser will request the updated address book entries.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Even though your Ajax responses are created dynamically, and might only be applicable to a single user, they can still be cached. Doing so will make your Web 2.0 apps faster.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;56&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.net/blog/archives/2007/09/high_performanc_12.html&quot; data-rapid_p=&quot;57&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;discuss this rule&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;flush&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Flush the Buffer Early&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;When users request a page, it can take anywhere from 200 to 500ms for the backend server to stitch together the HTML page. During this time, the browser is idle as it waits for the data to arrive. In PHP you have the function&amp;nbsp;&lt;a href=&quot;http://php.net/flush&quot; data-rapid_p=&quot;58&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;flush()&lt;/a&gt;. It allows you to send your partially ready HTML response to the browser so that the browser can start fetching components while your backend is busy with the rest of the HTML page. The benefit is mainly seen on busy backends or light frontends.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;A good place to consider flushing is right after the HEAD because the HTML for the head is usually easier to produce and it allows you to include any CSS and JavaScript files for the browser to start fetching in parallel while the backend is still processing.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Example:&lt;/p&gt;&lt;pre style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 13px; font-size: 13px;&quot;&gt;      ... &amp;lt;!-- css, js --&amp;gt;
    &amp;lt;/head&amp;gt;
    &lt;span class=&quot;hilite&quot; style=&quot;font-weight: bold; color: red;&quot;&gt;&amp;lt;?php flush(); ?&amp;gt;&lt;/span&gt;
    &amp;lt;body&amp;gt;
      ... &amp;lt;!-- content --&amp;gt;
&lt;/pre&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://search.yahoo.com/&quot; data-rapid_p=&quot;59&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Yahoo! search&lt;/a&gt;&amp;nbsp;pioneered research and real user testing to prove the benefits of using this technique.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;60&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;ajax_get&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Use GET for AJAX Requests&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The&amp;nbsp;&lt;a href=&quot;http://mail.yahoo.com/&quot; data-rapid_p=&quot;61&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Yahoo! Mail&lt;/a&gt;&amp;nbsp;team found that when using&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;XMLHttpRequest&lt;/code&gt;, POST is implemented in the browsers as a two-step process: sending the headers first, then sending data. So it's best to use GET, which only takes one TCP packet to send (unless you have a lot of cookies). The maximum URL length in IE is 2K, so if you send more than 2K data you might not be able to use GET.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;An interesting side affect is that POST without actually posting any data behaves like GET. Based on the&amp;nbsp;&lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html&quot; data-rapid_p=&quot;62&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;HTTP specs&lt;/a&gt;, GET is meant for retrieving information, so it makes sense (semantically) to use GET when you're only requesting data, as opposed to sending data to be stored server-side.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;63&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;postload&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Post-load Components&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;You can take a closer look at your page and ask yourself: &quot;What's absolutely required in order to render the page initially?&quot;. The rest of the content and components can wait.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;JavaScript is an ideal candidate for splitting before and after the onload event. For example if you have JavaScript code and libraries that do drag and drop and animations, those can wait, because dragging elements on the page comes after the initial rendering. Other places to look for candidates for post-loading include hidden content (content that appears after a user action) and images below the fold.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Tools to help you out in your effort:&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/yui/imageloader/&quot; data-rapid_p=&quot;64&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;YUI Image Loader&lt;/a&gt;&amp;nbsp;allows you to delay images below the fold and the&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/yui/get/&quot; data-rapid_p=&quot;65&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;YUI Get utility&lt;/a&gt;&amp;nbsp;is an easy way to include JS and CSS on the fly. For an example in the wild take a look at&amp;nbsp;&lt;a href=&quot;http://www.yahoo.com/&quot; data-rapid_p=&quot;66&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Yahoo! Home Page&lt;/a&gt;&amp;nbsp;with Firebug's Net Panel turned on.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;It's good when the performance goals are inline with other web development best practices. In this case, the idea of progressive enhancement tells us that JavaScript, when supported, can improve the user experience but you have to make sure the page works even without JavaScript. So after you've made sure the page works fine, you can enhance it with some post-loaded scripts that give you more bells and whistles such as drag and drop and animations.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;67&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;preload&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Preload Components&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Preload may look like the opposite of post-load, but it actually has a different goal. By preloading components you can take advantage of the time the browser is idle and request components (like images, styles and scripts) you'll need in the future. This way when the user visits the next page, you could have most of the components already in the cache and your page will load much faster for the user.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;There are actually several types of preloading:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;em&gt;Unconditional&lt;/em&gt;&amp;nbsp;preload - as soon as onload fires, you go ahead and fetch some extra components. Check google.com for an example of how a sprite image is requested onload. This sprite image is not needed on the google.com homepage, but it is needed on the consecutive search result page.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;em&gt;Conditional&lt;/em&gt;&amp;nbsp;preload - based on a user action you make an educated guess where the user is headed next and preload accordingly. On&amp;nbsp;&lt;a href=&quot;http://search.yahoo.com/&quot; data-rapid_p=&quot;68&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;search.yahoo.com&lt;/a&gt;&amp;nbsp;you can see how some extra components are requested after you start typing in the input box.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;em&gt;Anticipated&lt;/em&gt;&amp;nbsp;preload - preload in advance before launching a redesign. It often happens after a redesign that you hear: &quot;The new site is cool, but it's slower than before&quot;. Part of the problem could be that the users were visiting your old site with a full cache, but the new one is always an empty cache experience. You can mitigate this side effect by preloading some components before you even launched the redesign. Your old site can use the time the browser is idle and request images and scripts that will be used by the new site&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;69&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;min_dom&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Reduce the Number of DOM Elements&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;A complex page means more bytes to download and it also means slower DOM access in JavaScript. It makes a difference if you loop through 500 or 5000 DOM elements on the page when you want to add an event handler for example.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;A high number of DOM elements can be a symptom that there's something that should be improved with the markup of the page without necessarily removing content. Are you using nested tables for layout purposes? Are you throwing in more&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only to fix layout issues? Maybe there's a better and more semantically correct way to do your markup.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;A great help with layouts are the&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/yui/&quot; data-rapid_p=&quot;70&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;YUI CSS utilities&lt;/a&gt;: grids.css can help you with the overall layout, fonts.css and reset.css can help you strip away the browser's defaults formatting. This is a chance to start fresh and think about your markup, for example use&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s only when it makes sense semantically, and not because it renders a new line.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The number of DOM elements is easy to test, just type in Firebug's console:&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;document.getElementsByTagName('*').length&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;And how many DOM elements are too many? Check other similar pages that have good markup. For example the&amp;nbsp;&lt;a href=&quot;http://www.yahoo.com/&quot; data-rapid_p=&quot;71&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Yahoo! Home Page&lt;/a&gt;&amp;nbsp;is a pretty busy page and still under 700 elements (HTML tags).&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;72&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;split&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Split Components Across Domains&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Splitting components allows you to maximize parallel downloads. Make sure you're using not more than 2-4 domains because of the DNS lookup penalty. For example, you can host your HTML and dynamic content on&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;www.example.org&lt;/code&gt;&amp;nbsp;and split static components between&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;static1.example.org&lt;/code&gt;&amp;nbsp;and&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;static2.example.org&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For more information check &quot;&lt;a href=&quot;http://yuiblog.com/blog/2007/04/11/performance-research-part-4/&quot; data-rapid_p=&quot;73&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Maximizing Parallel Downloads in the Carpool Lane&lt;/a&gt;&quot; by Tenni Theurer and Patty Chi.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;74&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;iframes&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Minimize the Number of iframes&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Iframes allow an HTML document to be inserted in the parent document. It's important to understand how iframes work so they can be used effectively.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt;&amp;nbsp;pros:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Helps with slow third-party content like badges and ads&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Security sandbox&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Download scripts in parallel&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt;&amp;nbsp;cons:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Costly even if blank&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Blocks page onload&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Non-semantic&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;75&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;no404&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;No 404s&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: content&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;HTTP requests are expensive so making an HTTP request and getting a useless response (i.e. 404 Not Found) is totally unnecessary and will slow down the user experience without any benefit.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Some sites have helpful 404s &quot;Did you mean X?&quot;, which is great for the user experience but also wastes server resources (like database, etc). Particularly bad is when the link to an external JavaScript is wrong and the result is a 404. First, this download will block parallel downloads. Next the browser may try to parse the 404 response body as if it were JavaScript code, trying to find something usable in it.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;76&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;cookie_size&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Reduce Cookie Size&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: cookie&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;HTTP cookies are used for a variety of reasons such as authentication and personalization. Information about cookies is exchanged in the HTTP headers between web servers and browsers. It's important to keep the size of cookies as low as possible to minimize the impact on the user's response time.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For more information check&amp;nbsp;&lt;a href=&quot;http://yuiblog.com/blog/2007/03/01/performance-research-part-3/&quot; data-rapid_p=&quot;77&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&quot;When the Cookie Crumbles&quot;&lt;/a&gt;&amp;nbsp;by Tenni Theurer and Patty Chi. The take-home of this research:&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Eliminate unnecessary cookies&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Keep cookie sizes as low as possible to minimize the impact on the user response time&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Be mindful of setting cookies at the appropriate domain level so other sub-domains are not affected&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Set an Expires date appropriately. An earlier Expires date or none removes the cookie sooner, improving the user response time&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;78&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;cookie_free&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Use Cookie-free Domains for Components&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: cookie&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;If your domain is&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;www.example.org&lt;/code&gt;, you can host your static components on&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;static.example.org&lt;/code&gt;. However, if you've already set cookies on the top-level domain&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;example.org&lt;/code&gt;&amp;nbsp;as opposed to&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;www.example.org&lt;/code&gt;, then all the requests to&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;static.example.org&lt;/code&gt;&amp;nbsp;will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;yimg.com&lt;/code&gt;, YouTube uses&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;ytimg.com&lt;/code&gt;, Amazon uses&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;images-amazon.com&lt;/code&gt;&amp;nbsp;and so on.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Another benefit of hosting static components on a cookie-free domain is that some proxies might refuse to cache the components that are requested with cookies. On a related note, if you wonder if you should use example.org or www.example.org for your home page, consider the cookie impact. Omitting www leaves you no choice but to write cookies to&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;*.example.org&lt;/code&gt;, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;79&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;dom_access&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Minimize DOM Access&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Accessing DOM elements with JavaScript is slow so in order to have a more responsive page, you should:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Cache references to accessed elements&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Update nodes &quot;offline&quot; and then add them to the tree&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Avoid fixing layout with JavaScript&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For more information check the YUI theatre's&amp;nbsp;&lt;a href=&quot;http://yuiblog.com/blog/2007/12/20/video-lecomte/&quot; data-rapid_p=&quot;80&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&quot;High Performance Ajax Applications&quot;&lt;/a&gt;&amp;nbsp;by Julien Lecomte.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;81&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;events&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Develop Smart Event Handlers&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: javascript&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Sometimes pages feel less responsive because of too many event handlers attached to different elements of the DOM tree which are then executed too often. That's why using&amp;nbsp;&lt;em&gt;event delegation&lt;/em&gt;&amp;nbsp;is a good approach. If you have 10 buttons inside a&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;div&lt;/code&gt;, attach only one event handler to the div wrapper, instead of one handler for each button. Events bubble up so you'll be able to catch the event and figure out which button it originated from.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;You also don't need to wait for the onload event in order to start doing something with the DOM tree. Often all you need is the element you want to access to be available in the tree. You don't have to wait for all images to be downloaded.&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;DOMContentLoaded&lt;/code&gt;&amp;nbsp;is the event you might consider using instead of onload, but until it's available in all browsers, you can use the&amp;nbsp;&lt;a href=&quot;http://developer.yahoo.com/yui/event/&quot; data-rapid_p=&quot;82&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;YUI Event&lt;/a&gt;&amp;nbsp;utility, which has an&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/yui/event/#onavailable&quot; data-rapid_p=&quot;83&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;onAvailable&lt;/a&gt;&lt;/code&gt;&amp;nbsp;method.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For more information check the YUI theatre's&amp;nbsp;&lt;a href=&quot;http://yuiblog.com/blog/2007/12/20/video-lecomte/&quot; data-rapid_p=&quot;84&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;&quot;High Performance Ajax Applications&quot;&lt;/a&gt;&amp;nbsp;by Julien Lecomte.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;85&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;csslink&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Choose &amp;lt;link&amp;gt; over @import&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;One of the previous best practices states that CSS should be at the top in order to allow for progressive rendering.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;In IE&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;@import&lt;/code&gt;&amp;nbsp;behaves the same as using&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;link&amp;gt;&lt;/code&gt;&amp;nbsp;at the bottom of the page, so it's best not to use it.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;86&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;no_filters&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Avoid Filters&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: css&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The IE-proprietary&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;AlphaImageLoader&lt;/code&gt;&amp;nbsp;filter aims to fix a problem with semi-transparent true color PNGs in IE versions &amp;lt; 7. The problem with this filter is that it blocks rendering and freezes the browser while the image is being downloaded. It also increases memory consumption and is applied per element, not per image, so the problem is multiplied.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The best approach is to avoid&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;AlphaImageLoader&lt;/code&gt;&amp;nbsp;completely and use gracefully degrading PNG8 instead, which are fine in IE. If you absolutely need&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;AlphaImageLoader&lt;/code&gt;, use the underscore hack&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;_filter&lt;/code&gt;&amp;nbsp;as to not penalize your IE7+ users.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;87&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;opt_images&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Optimize Images&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: images&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;After a designer is done with creating the images for your web page, there are still some things you can try before you FTP those images to your web server.&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;You can check the GIFs and see if they are using a palette size corresponding to the number of colors in the image. Using&amp;nbsp;&lt;a href=&quot;http://www.imagemagick.org/&quot; data-rapid_p=&quot;88&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;imagemagick&lt;/a&gt;&amp;nbsp;it's easy to check using&amp;nbsp;&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;identify -verbose image.gif&lt;/code&gt;&amp;nbsp;&lt;br /&gt;When you see an image using 4 colors and a 256 color &quot;slots&quot; in the palette, there is room for improvement.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Try converting GIFs to PNGs and see if there is a saving. More often than not, there is. Developers often hesitate to use PNGs due to the limited support in browsers, but this is now a thing of the past. The only real problem is alpha-transparency in true color PNGs, but then again, GIFs are not true color and don't support variable transparency either. So anything a GIF can do, a palette PNG (PNG8) can do too (except for animations). This simple imagemagick command results in totally safe-to-use PNGs:&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;convert image.gif image.png&lt;/code&gt;&amp;nbsp;&lt;br /&gt;&quot;All we are saying is: Give PiNG a Chance!&quot;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Run&amp;nbsp;&lt;a href=&quot;http://pmt.sourceforge.net/pngcrush/&quot; data-rapid_p=&quot;89&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;pngcrush&lt;/a&gt;&amp;nbsp;(or any other PNG optimizer tool) on all your PNGs. Example:&amp;nbsp;&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;pngcrush image.png -rem alla -reduce -brute result.png&lt;/code&gt;&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Run jpegtran on all your JPEGs. This tool does lossless JPEG operations such as rotation and can also be used to optimize and remove comments and other useless information (such as EXIF information) from your images.&amp;nbsp;&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;jpegtran -copy none -optimize -perfect src.jpg dest.jpg&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;90&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;opt_sprites&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Optimize CSS Sprites&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: images&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Arranging the images in the sprite horizontally as opposed to vertically usually results in a smaller file size.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Combining similar colors in a sprite helps you keep the color count low, ideally under 256 colors so to fit in a PNG8.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&quot;Be mobile-friendly&quot; and don't leave big gaps between the images in a sprite. This doesn't affect the file size as much but requires less memory for the user agent to decompress the image into a pixel map. 100x100 image is 10 thousand pixels, where 1000x1000 is 1 million pixels&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;91&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;no_scale&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Don't Scale Images in HTML&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: images&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Don't use a bigger image than you need just because you can set the width and height in HTML. If you need&amp;nbsp;&lt;br /&gt;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;&amp;lt;img width=&quot;100&quot; height=&quot;100&quot; src=&quot;mycat.jpg&quot; alt=&quot;My Cat&quot; /&amp;gt;&lt;/code&gt;&amp;nbsp;&lt;br /&gt;then your image (mycat.jpg) should be 100x100px rather than a scaled down 500x500px image.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;92&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;favicon&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Make favicon.ico Small and Cacheable&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: images&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The favicon.ico is an image that stays in the root of your server. It's a necessary evil because even if you don't care about it the browser will still request it, so it's better not to respond with a&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px; line-height: 13px;&quot;&gt;404 Not Found&lt;/code&gt;. Also since it's on the same server, cookies are sent every time it's requested. This image also interferes with the download sequence, for example in IE when you request extra components in the onload, the favicon will be downloaded before these extra components.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;So to mitigate the drawbacks of having a favicon.ico make sure:&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;It's small, preferably under 1K.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;Set Expires header with what you feel comfortable (since you cannot rename it if you decide to change it). You can probably safely set the Expires header a few months in the future. You can check the last modified date of your current favicon.ico to make an informed decision.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://www.imagemagick.org/&quot; data-rapid_p=&quot;93&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Imagemagick&lt;/a&gt;&amp;nbsp;can help you create small favicons&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;94&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;under25&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Keep Components under 25K&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: mobile&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;This restriction is related to the fact that iPhone won't cache components bigger than 25K. Note that this is the&amp;nbsp;&lt;em&gt;uncompressed&lt;/em&gt;&amp;nbsp;size. This is where minification is important because gzip alone may not be sufficient.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;For more information check &quot;&lt;a href=&quot;http://yuiblog.com/blog/2008/02/06/iphone-cacheability/&quot; data-rapid_p=&quot;95&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Performance Research, Part 5: iPhone Cacheability - Making it Stick&lt;/a&gt;&quot; by Wayne Shea and Tenni Theurer.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;96&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;&lt;h3 id=&quot;multipart&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Pack Components into a Multipart Document&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: mobile&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Packing components into a multipart document is like an email with attachments, it helps you fetch several components with one HTTP request (remember: HTTP requests are expensive). When you use this technique, first check if the user agent supports it (iPhone does not).&lt;/p&gt;&lt;h3 id=&quot;emptysrc&quot; style=&quot;margin: 1em 0px 0.4em; padding: 0px; font-size: 21px; font-weight: normal; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif;&quot;&gt;Avoid Empty Image src&lt;/h3&gt;&lt;p class=&quot;date&quot; style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;tag: server&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Image with empty string&amp;nbsp;&lt;b&gt;src&lt;/b&gt;&amp;nbsp;attribute occurs more than one will expect. It appears in two form:&lt;/p&gt;&lt;ol style=&quot;margin: 0px 0px 0px 2em; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li style=&quot;margin: 0px 0px 0.3em; padding: 0px; list-style: decimal;&quot;&gt;straight HTML&lt;br /&gt;&lt;blockquote style=&quot;margin: 0px 2em 1em; padding: 0px;&quot;&gt;&amp;lt;img src=&quot;&quot;&amp;gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;li style=&quot;margin: 0px 0px 0.3em; padding: 0px; list-style: decimal;&quot;&gt;JavaScript&lt;br /&gt;&lt;blockquote style=&quot;margin: 0px 2em 1em; padding: 0px;&quot;&gt;var img = new Image();&lt;br /&gt;img.src = &quot;&quot;;&lt;/blockquote&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;Both forms cause the same effect: browser makes another request to your server.&lt;/p&gt;&lt;ul style=&quot;margin: 0px; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;b&gt;Internet Explorer&lt;/b&gt;&amp;nbsp;makes a request to the directory in which the page is located.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;b&gt;Safari and Chrome&lt;/b&gt;&amp;nbsp;make a request to the actual page itself.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;b&gt;Firefox&lt;/b&gt;&amp;nbsp;3 and earlier versions behave the same as Safari and Chrome, but version 3.5 addressed this issue&lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=444931&quot; data-rapid_p=&quot;97&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;[bug 444931]&lt;/a&gt;&amp;nbsp;and no longer sends a request.&lt;/li&gt;&lt;li class=&quot;bullist&quot; style=&quot;margin: 0px 0px 0.3em 2em; padding: 0px; list-style: disc;&quot;&gt;&lt;b&gt;Opera&lt;/b&gt;&amp;nbsp;does not do anything when an empty image src is encountered.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;b&gt;Why is this behavior bad?&lt;/b&gt;&lt;/p&gt;&lt;ol style=&quot;margin: 0px 0px 0px 2em; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;li style=&quot;margin: 0px 0px 0.3em; padding: 0px; list-style: decimal;&quot;&gt;Cripple your servers by sending a large amount of unexpected traffic, especially for pages that get millions of page views per day.&lt;/li&gt;&lt;li style=&quot;margin: 0px 0px 0.3em; padding: 0px; list-style: decimal;&quot;&gt;Waste server computing cycles generating a page that will never be viewed.&lt;/li&gt;&lt;li style=&quot;margin: 0px 0px 0.3em; padding: 0px; list-style: decimal;&quot;&gt;Possibly corrupt user data. If you are tracking state in the request, either by cookies or in another way, you have the possibility of destroying data. Even though the image request does not return an image, all of the headers are read and accepted by the browser, including all cookies. While the rest of the response is thrown away, the damage may already be done.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;br style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;The root cause of this behavior is the way that URI resolution is performed in browsers. This behavior is defined in RFC 3986 - Uniform Resource Identifiers. When an empty string is encountered as a URI, it is considered a relative URI and is resolved according to the algorithm defined in section 5.2. This specific example, an empty string, is listed in section 5.4. Firefox, Safari, and Chrome are all resolving an empty string correctly per the specification, while Internet Explorer is resolving it incorrectly, apparently in line with an earlier version of the specification, RFC 2396 - Uniform Resource Identifiers (this was obsoleted by RFC 3986). So technically, the browsers are doing what they are supposed to do to resolve relative URIs. The problem is that in this context, the empty string is clearly unintentional.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;HTML5 adds to the description of the&amp;nbsp;&lt;img style=&quot;border: 0px;&quot;&gt;&amp;nbsp;tag's src attribute to instruct browsers not to make an additional request in section 4.8.2:&lt;/p&gt;&lt;blockquote style=&quot;margin: 0px 2em 1em; padding: 0px; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;The src attribute must be present, and must contain a valid URL referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted. If the base URI of the element is the same as the document's address, then the src attribute's value must not be the empty string.&lt;/blockquote&gt;&lt;p&gt;&lt;span style=&quot;font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px; line-height: 16px;&quot;&gt;Hopefully, browsers will not have this problem in the future. Unfortunately, there is no such clause for &amp;lt;script src=&quot;&quot;&amp;gt; and &amp;lt;link href=&quot;&quot;&amp;gt;. Maybe there is still time to make that adjustment to ensure browsers don't accidentally implement this behavior.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;This rule was inspired by Yahoo!'s JavaScript guru Nicolas C. Zakas. For more information check out his article &quot;&lt;a href=&quot;http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/&quot; data-rapid_p=&quot;98&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;Empty image src can destroy your site&lt;/a&gt;&quot;.&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px 0px 1em; line-height: 1.49em; font-family: OpenSans, 'Helvetica Neue', 'Helvetica Neue', helvetica, arial, clean, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://developer.yahoo.com/performance/rules.html#page-nav&quot; data-rapid_p=&quot;99&quot; style=&quot;color: rgb(24, 118, 199); cursor: pointer;&quot;&gt;top&lt;/a&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>Javscript</category>
      <category>성능 향상</category>
      <category>웹페이지</category>
      <category>자바스크립트</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/179</guid>
      <comments>https://epicdevsold.tistory.com/179#entry179comment</comments>
      <pubDate>Sun, 26 May 2013 14:44:00 +0900</pubDate>
    </item>
    <item>
      <title>함수와 메소드의 차이</title>
      <link>https://epicdevsold.tistory.com/178</link>
      <description>&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;여태껏 함수와 메소드, 변수와 필드등의 용어들을 혼재해서 막 써왔었는데 이번 기회에 확실하게 기억해 놓아야 겠습니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;아래의 표를 보시면 각 객체지향언어에서 멤버 변수와 멤버 함수들을 어떻게 지칭하는지 알 수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;출처:&amp;nbsp;&lt;a href=&quot;http://blog.naver.com/cdincdin?Redirect=Log&amp;amp;logNo=30129625682&quot; style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;http://blog.naver.com/cdincdin?Redirect=Log&amp;amp;logNo=30129625682&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 565px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/035FD64A516EB90633&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F035FD64A516EB90633&quot; width=&quot;565&quot; height=&quot;339&quot; filename=&quot;method.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>c#</category>
      <category>C++</category>
      <category>Java</category>
      <category>객체지향</category>
      <category>메소드</category>
      <category>멤버</category>
      <category>변수</category>
      <category>필드</category>
      <category>함수</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/178</guid>
      <comments>https://epicdevsold.tistory.com/178#entry178comment</comments>
      <pubDate>Thu, 18 Apr 2013 00:02:40 +0900</pubDate>
    </item>
    <item>
      <title>객체지향 상속의 종류: 서브클래싱과 서브타이핑 (Subclassing  &amp;amp; Subtyping)</title>
      <link>https://epicdevsold.tistory.com/177</link>
      <description>&lt;p&gt;출처:&amp;nbsp;&lt;a href=&quot;http://hyukmini.tistory.com/entry/%EC%84%9C%EB%B8%8C%ED%83%80%EC%9D%B4%ED%95%91Sub-Typing%EA%B3%BC-%EC%84%9C%EB%B8%8C%ED%81%B4%EB%9E%98%EC%8B%B1Sub-Classing&quot; style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;http://hyukmini.tistory.com/entry/%EC%84%9C%EB%B8%8C%ED%83%80%EC%9D%B4%ED%95%91Sub-Typing%EA%B3%BC-%EC%84%9C%EB%B8%8C%ED%81%B4%EB%9E%98%EC%8B%B1Sub-Classing&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div style=&quot;margin: 0px; padding: 0px; color: rgb(144, 144, 144); line-height: 20px;&quot;&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px;&quot;&gt;&lt;font face=&quot;trebuchet ms, geneva&quot; size=&quot;2&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51);&quot;&gt;[요약]&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px;&quot;&gt;&lt;font face=&quot;trebuchet ms, geneva&quot; size=&quot;2&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51);&quot;&gt;서브클래싱은 구현되어 있는 클래스를 상속하는 것&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style=&quot;margin-right: 0px; margin-left: 0px; padding: 0px;&quot;&gt;&lt;font face=&quot;trebuchet ms, geneva&quot; size=&quot;2&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51);&quot;&gt;서브타이핑은 정의되어 있는&amp;nbsp;인터페이스를 구현하는 것&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style=&quot;font-family: dotum, appleGothic, sans-serif; margin-right: 0px; margin-left: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style=&quot;font-family: dotum, appleGothic, sans-serif; margin-right: 0px; margin-left: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;두 의미를 살피기 전에 Class(클래스)와 Type(타입)의 의미를 짚고 넘어가겠습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Integer a = new Integer(7);&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;객체 a를 생성하기 위해 앞에 붙인 Integer를 부를 때&amp;nbsp;Class 혹은 Type 이라고 부릅니다. 우리는 무의식적으로 둘을 혼용해서 쓰고 있습니다. 차이점이 없는 것 같지만 둘은 차이가 존재하고 개발자는 이를&amp;nbsp;구분지을 수 있어야&amp;nbsp;상속을 통한 상황에 맞는 적절한 객체지향 프로그래밍을 구사할 수 있습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;클래스는 &quot;객체가 수행할 행동에 대한&amp;nbsp;연산의 집합&quot;으로 정의할 수 있습니다.&amp;nbsp;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;클래스는 값을 저장할 변수와&amp;nbsp;행동에&amp;nbsp;대한 연산이 구현된&amp;nbsp;메소드들로 구성되어 있습니다.&amp;nbsp;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;타입은 &quot;객체가 수행할 행동에 대한 약속의 집합&quot;으로 정의할 수 있습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;타입은 수행할 행동만 약속함으로써 메소드의 선언들로만 구성되어 있습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;Java, C# 같은 언어에서는 interface를 통해 타입을 정의할 수 있습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;이제&amp;nbsp;상속 이야기로 가볼까요? 객체지향에서는 2가지 상속 메카니즘이 존재합니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span id=&quot;callbacknesthyukminitistorycom169991&quot; style=&quot;margin: 0px; padding: 0px; width: 1px; height: 1px; float: right;&quot;&gt;&lt;/span&gt;상속이란 부모와 자식이 존재할 때&amp;nbsp;자식이 자신의 행동과 부모의 행동을 받아들일 수 있는 관계를 뜻합니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;상속은 클래스와 타입을 구분하듯이&amp;nbsp;클래스를 상속하는 Subclassing과 타입을 상속하는 Subtyping으로 구분됩니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 4em; padding: 0px; color: rgb(144, 144, 144); font-family: dotum, appleGothic, sans-serif; line-height: 20px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px; padding: 0px; color: rgb(144, 144, 144); font-family: dotum, appleGothic, sans-serif; line-height: 20px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;blockquote style=&quot;margin: 5px 0px; padding: 0px 0px 0px 70px; min-height: 50px; background-image: url(http://ts.daumcdn.net/blog/skin/tis_MilkyWay_White/images/iconBlockquote.gif); color: rgb(125, 187, 28); background-position: 0px 0px; background-repeat: no-repeat no-repeat;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px;&quot;&gt;Subclassing&lt;/strong&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;Super Class(슈퍼 클래스)에 구현된&amp;nbsp;코드와 내부 표현 구조를&amp;nbsp;Sub Class(하위 클래스)가 이어받습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;클래스 상속으로 불리기도 하며 하위 클래스에서 슈퍼 클래스에 구현된 코드의 재사용이 가능합니다.&lt;/blockquote&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span id=&quot;tx_beforestart_mark&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/span&gt;C#을 통해 서브클래싱(클래스 상속)의 예를 들어 보겠습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class A&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String Name()&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is A&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class B : A {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String Name() {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is B&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;public static void&amp;nbsp;PrintName(A obj) {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(obj.Name());&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;static void Main(string[] args) {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;objA = new A();&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;objB = new B();&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintName(objA);&amp;nbsp;&amp;nbsp; =&amp;gt;&amp;nbsp;Class name is A&amp;nbsp;&amp;nbsp; - (1)&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintName(objB);&amp;nbsp;&amp;nbsp; =&amp;gt; Class name is A&amp;nbsp;&amp;nbsp; - (2)&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;(2)의 결과는 예상과 조금 다르게 나옵니다.&amp;nbsp; 클래스 상속은 부모 클래스의 코드를 재사용하기 때문에 위와 같이 슈퍼클래스의 객체를&amp;nbsp;하위클래스의 객체로 대체하더라도 하위 클래스의 행동으로 대체되어 동작하지 않습니다. 이는 메소드 재정의(method overriding)를 통해 부모 클래스의 메소드를 대체하여야 합니다. C#에서는 부모에는 virtual 키워드를 넣어&amp;nbsp;가상함수로 정의하고 자식에는 override 키워드를 넣어 메소드 구현을 재정의를 합니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class A&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&amp;nbsp;virtual&amp;nbsp;String Name()&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is A&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;/font&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class B : A {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public override String Name() {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is B&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;/font&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span id=&quot;tx_afterend_mark&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/span&gt;&lt;/font&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;blockquote style=&quot;margin: 5px 0px; padding: 0px 0px 0px 70px; min-height: 50px; background-image: url(http://ts.daumcdn.net/blog/skin/tis_MilkyWay_White/images/iconBlockquote.gif); color: rgb(125, 187, 28); background-position: 0px 0px; background-repeat: no-repeat no-repeat;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; font-size: 12pt;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; font-size: 10pt;&quot;&gt;Subtyping&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; font-size: 12pt;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; font-size: 10pt;&quot;&gt;Super Type(슈퍼 타입)의 객체가 수행할 행동의 약속을 Sub Type(서브 타입)이 이어받습니다. 행동들을 공통된&amp;nbsp;타입으로 묶어&amp;nbsp;Runtime에 슈퍼 타입의 객체를 서브 타입의 객체로&amp;nbsp;대체가 가능하도록 해줍니다.&amp;nbsp;이를 통해 프로그램 변경에 대한 영향을 최소화하여 변경에 대한&amp;nbsp;유연한 대처가 가능토록 제공합니다.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&amp;nbsp;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;C#을 통해 인터페이스를 통한 서브타이핑의 예를 들어 보겠습니다.&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;interface MyClass&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String Name();&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class&amp;nbsp;A&amp;nbsp;: MyClass {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String Name()&amp;nbsp; {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is A&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;/font&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;'trebuchet ms',geneva&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;class B :&amp;nbsp;MyClass {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String Name() {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;Class name is B&quot;;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;public static void&amp;nbsp;PrintName(MyClass obj) {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(obj.Name());&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;static void Main(string[] args) {&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyClass objA = new A();&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyClass objB = new B();&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintName(objA);&amp;nbsp;&amp;nbsp; =&amp;gt;&amp;nbsp;Class name is A&amp;nbsp;&amp;nbsp; - (1)&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintName(objB);&amp;nbsp;&amp;nbsp; =&amp;gt; Class name is&amp;nbsp;B&amp;nbsp;&amp;nbsp; - (2)&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;}&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot;&gt;인터페이스 상속은 부모 타입의&amp;nbsp;행동의 약속만&amp;nbsp;상속받습니다. (C#에서 인터페이스에&amp;nbsp;메소드만 기술할 수 있습니다.)&amp;nbsp;따라서 슈퍼타입의 객체를&amp;nbsp;하위타입의 객체로&amp;nbsp;대체하면&amp;nbsp;동적으로&amp;nbsp;하위 타입의&amp;nbsp;행동으로 대체되어 호출이 됩니다.&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/font&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>객체지향</category>
      <category>상속</category>
      <category>서브클래싱</category>
      <category>서브타이핑</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/177</guid>
      <comments>https://epicdevsold.tistory.com/177#entry177comment</comments>
      <pubDate>Tue, 16 Apr 2013 10:38:54 +0900</pubDate>
    </item>
    <item>
      <title>Class를 dynamic하게 loading할 때 Class.forName()과 ClassLoader.loadClass()의 차이점</title>
      <link>https://epicdevsold.tistory.com/176</link>
      <description>&lt;p&gt;출처:&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/8100376/class-forname-vs-classloader-loadclass-which-to-use-for-dynamic-loading&quot; style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;http://stackoverflow.com/questions/8100376/class-forname-vs-classloader-loadclass-which-to-use-for-dynamic-loading&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Class.forName()의 경우 이 메소드를 호출한 클래스의 class loader를 사용한다. 그리고 생성되는 클래스의 전역&amp;nbsp;초기화 코드가 실행된다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;ClassLoader.loadClass()의 경우 주어진 class loader를 사용하며, 생성되는 클래스의 전역 초기화 코드가 실행되지 않는다.&lt;/p&gt;</description>
      <category>Archive</category>
      <category>Class</category>
      <category>ClassLoader</category>
      <category>forName</category>
      <category>Java</category>
      <category>전역</category>
      <category>초기화</category>
      <category>클래스</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/176</guid>
      <comments>https://epicdevsold.tistory.com/176#entry176comment</comments>
      <pubDate>Wed, 3 Apr 2013 09:13:05 +0900</pubDate>
    </item>
    <item>
      <title>Effective Java 목차</title>
      <link>https://epicdevsold.tistory.com/175</link>
      <description>&lt;p&gt;이 항목들을 가끔씩 보면서 각각의 아이템들이 어떤 것을 의미했었는지 되새겨 보는 것도 좋을 것 같습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;1. Creating and Destroying Objects&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Item 1: Consider static factory methods instead of constructors&lt;/p&gt;&lt;p&gt;Item 2: Consider a builder when faced with many constructor parameters&lt;/p&gt;&lt;p&gt;Item 3: Enforce the singleton property with a private constructor or an enum type&lt;/p&gt;&lt;p&gt;Item 4: Enforce noninstantiability with a private constructor&lt;/p&gt;&lt;p&gt;Item 5: Avoid creating unnecessary objects&lt;/p&gt;&lt;p&gt;Item 6: Eliminate obsolete object references&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;Item 7: Avoid finalizers&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;2. Methods Common to All Objects&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Item 8: Obey the general contract when overriding equals&lt;/p&gt;&lt;p&gt;Item 9: Always override hashCode when you override equals&lt;/p&gt;&lt;p&gt;Item 10: Always override toString&lt;/p&gt;&lt;p&gt;Item 11: Override clone judiciously&lt;/p&gt;&lt;p&gt;Item 12: Consider implementing Comparable&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;3. Classes and Interfaces&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 13: Minimize the accessibility of classes and members&lt;/p&gt;&lt;p&gt;Item 14: In public classes, use accessor methods, not public fields&lt;/p&gt;&lt;p&gt;Item 15: Minimize mutability&lt;/p&gt;&lt;p&gt;Item 16: Favor composition over inheritance&lt;/p&gt;&lt;p&gt;Item 17: Design and document for inheritance or else prohibit it&lt;/p&gt;&lt;p&gt;Item 18: Prefer interfaces to abstract classes&lt;/p&gt;&lt;p&gt;Item 19: Use interfaces only to define types&lt;/p&gt;&lt;p&gt;Item 20: Prefer class hierarchies to tagged classes&lt;/p&gt;&lt;p&gt;Item 21: Use function objects to represent strategies&lt;/p&gt;&lt;p&gt;Item 22: Favor static member classes over nonstatic&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;4. Generics&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Item 23: Don't use raw types in new code&lt;/p&gt;&lt;p&gt;Item 24: Eliminate unchecked warnings&lt;/p&gt;&lt;p&gt;Item 25: Prefer lists to arrays&lt;/p&gt;&lt;p&gt;Item 26: Favor generic types&lt;/p&gt;&lt;p&gt;Item 27: Favor generic methods&lt;/p&gt;&lt;p&gt;Item 28: Use bounded wildcards to increase API flexibility&lt;/p&gt;&lt;p&gt;Item 29: Consider typesafe heterogeneous containers&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;5. Enums and Annotations&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 30: Use enums instead of int constants&lt;/p&gt;&lt;p&gt;Item 31: Use instance fields instead of ordinals&lt;/p&gt;&lt;p&gt;Item 32: Use EnumSet instead of bit fields&lt;/p&gt;&lt;p&gt;Item 33: Use EnumMap instead of ordinal indexing&lt;/p&gt;&lt;p&gt;Item 34: Emulate extensible enums with interfaces&lt;/p&gt;&lt;p&gt;Item 35: Prefer annotations to naming patterns&lt;/p&gt;&lt;p&gt;Item 36: Consistently use the Override annotation&lt;/p&gt;&lt;p&gt;Item 37: Use marker interfaces to define types&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;6. Methods&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 38: Check parameters for validity&lt;/p&gt;&lt;p&gt;Item 39: Make defensive copies when needed&lt;/p&gt;&lt;p&gt;Item 40: Design method signatures carefully&lt;/p&gt;&lt;p&gt;Item 41: Use overloading judiciously&lt;/p&gt;&lt;p&gt;Item 42: Use varargs judiciously&lt;/p&gt;&lt;p&gt;Item 43: Return empty arrays or collections, not nulls&lt;/p&gt;&lt;p&gt;Item 44: Write doc comments for all exposed API elements&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;7. General Programming&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 45: Minimize the scope of local variables&lt;/p&gt;&lt;p&gt;Item 46: Prefer for-each loops to traditional for loops&lt;/p&gt;&lt;p&gt;Item 47: Know and use the libraries&lt;/p&gt;&lt;p&gt;Item 48: Avoid float and double if exact answers are required&lt;/p&gt;&lt;p&gt;Item 49: Prefer primitive types to boxed primitives&lt;/p&gt;&lt;p&gt;Item 50: Avoid strings where other types are more appropriate&lt;/p&gt;&lt;p&gt;Item 51: Beware the performance of string concatenation&lt;/p&gt;&lt;p&gt;Item 52: Refer to objects by their interfaces&lt;/p&gt;&lt;p&gt;Item 53: Prefer interfaces to reflection&lt;/p&gt;&lt;p&gt;Item 54: Use native methods judiciously&lt;/p&gt;&lt;p&gt;Item 55: Optimize judiciously&lt;/p&gt;&lt;p&gt;Item 56: Adhere to generally accepted naming conventions&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;8. Exceptions&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 57: Use exceptions only for exceptional conditions&lt;/p&gt;&lt;p&gt;Item 58: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors&lt;/p&gt;&lt;p&gt;Item 59: Avoid unnecessary use of checked exceptions&lt;/p&gt;&lt;p&gt;Item 60: Favor the use of standard exceptions&lt;/p&gt;&lt;p&gt;Item 61: Throw exceptions appropriate to the abstraction&lt;/p&gt;&lt;p&gt;Item 62: Document all exceptions thrown by each method&lt;/p&gt;&lt;p&gt;Item 63: Include failure-capture information in detail messages&lt;/p&gt;&lt;p&gt;Item 64: Strive for failure atomicity&lt;/p&gt;&lt;p&gt;Item 65: Don't ignore exceptions&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;9. Concurrency&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 66: Synchronize access to shared mutable data&lt;/p&gt;&lt;p&gt;Item 67: Avoid excessive synchronization&lt;/p&gt;&lt;p&gt;Item 68: Prefer executors and tasks to threads&lt;/p&gt;&lt;p&gt;Item 69: Prefer concurrency utilities to wait and notify&lt;/p&gt;&lt;p&gt;Item 70: Document thread safety&lt;/p&gt;&lt;p&gt;Item 71: Use lazy initialization judiciously&lt;/p&gt;&lt;p&gt;Item 72: Don't depend on the thread scheduler&lt;/p&gt;&lt;p&gt;Item 73: Avoid thread groups&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;10. Serialization&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Item 74: Implement Serializable judiciously&lt;/p&gt;&lt;p&gt;Item 75: Consider using a custom serialized form&lt;/p&gt;&lt;p&gt;Item 76: Write readObject methods defensively&lt;/p&gt;&lt;p&gt;Item 77: For instance control, prefer enum types to readResolve&lt;/p&gt;&lt;p&gt;Item 78: Consider serialization proxies instead of serialized instances&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;txc-info&quot; id=&quot;txc_book_detail_ENG9780321356680&quot; point=&quot;&quot; style=&quot;clear: both; font-size: 9pt; line-height: 1.5; margin: 0px; padding: 0px; width: 530px; border: medium none; background-image: none; background-attachment: scroll; background-color: transparent; background-position: 0px 0px; background-repeat: repeat repeat;&quot;&gt;&lt;hr style=&quot;margin:0 0 10px;*margin:-7px 0 3px 0; filter:alpha(opacity=10); opacity:0.1; background:none #333333; border:medium none; clear:both; display:block; height:1px; overflow:hidden; padding:0; width:530px;&quot;&gt;&lt;div style=&quot;float:left; margin:0 10px 10px 0; padding:0; position:relative;&quot;&gt;	&lt;a href=&quot;http://book.daum.net/detail/book.do?bookid=ENG9780321356680&quot; target=&quot;_blank&quot;&gt;		&lt;img class=&quot;photo&quot; width=&quot;72&quot; height=&quot;104&quot; src=&quot;http://book.daum-img.net/R72x100/ENG9780321356680&quot; border=&quot;0&quot; onerror=&quot;this.src='http://icon.daum-img.net/editor/db_img_book.gif?rv=1.0.1'&quot;&gt;	&lt;/a&gt;&lt;/div&gt;&lt;h3 style=&quot;font-size:1em;margin:0;padding:0;&quot;&gt;	&lt;a class=&quot;item fn url&quot; href=&quot;http://book.daum.net/detail/book.do?bookid=ENG9780321356680&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none;  border:medium none; position:static;&quot;&gt;Effective Java, 2/E(Paperback)&lt;/a&gt;&lt;/h3&gt;&lt;dl class=&quot;book detail&quot; style=&quot;margin:5px 0  0 82px;&quot;&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;저자&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net//search/bookSearch.do?advancedSearchYN=y&amp;amp;author=Block%2C%20Joshua&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;Block, Joshua&lt;/a&gt; 지음&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;출판사&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net/search/bookSearch.do?advancedSearchYN=y&amp;amp;publisher=Addison-Wesley&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;Addison-Wesley&lt;/a&gt; &lt;span style=&quot;font-size:1em; height:1%; zoom:1; filter:alpha(opacity=20); opacity:0.2;&quot;&gt;|&lt;/span&gt; 2008-06-09 출간&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;카테고리&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net/category/book.do?categoryID=ENG13&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;과학/기술&lt;/a&gt;&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;책소개&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;Designed to help Java programmers m...&lt;/dd&gt;&lt;/dl&gt;&lt;div style=&quot;margin:5px 5px 0 82px; padding:0;&quot;&gt;	&lt;a href=&quot;http://book.daum.net/detail/book.do?bookid=ENG9780321356680#tab_comp&quot; target=&quot;_blank&quot; style=&quot;float:right&quot;&gt;&lt;img width=&quot;62&quot; height=&quot;22&quot; src=&quot;http://deco.daum-img.net/contents/info/bt_info_compare.gif?rv=1.0.1&quot; border=&quot;0&quot; alt=&quot;가격비교&quot;&gt;&lt;/a&gt;	&lt;strong class=&quot;rating&quot; style=&quot;border-bottom-width:0;font-weight:bold;&quot;&gt;&lt;/strong&gt;&lt;/div&gt;&lt;hr style=&quot;margin:10px 0 0;*margin:3px 0 -7px 0;opacity:0.1;filter:alpha(opacity=10);line-height:0;font-size:0; background:none #333333; border:medium none; clear:both; display:block; height:1px; overflow:hidden; padding:0; width:530px;&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;http://editor.daum.net/view/info/7.0/book.js&quot; charset=&quot;utf-8&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;script src=&quot;http://cia.daum.net/view/book/book/ENG9780321356680.js?callback=txCiaCallback&quot; charset=&quot;utf-8&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;!--DB_EMBEDDING_START--&gt;
&lt;TXDB name=&quot;책&quot; id=&quot;txd_book_detail_ENG9780321356680&quot;&gt;
	&lt;TXDBITEM title=&quot;Effective Java, 2/E(Paperback)&quot;&gt;&lt;/TXDBITEM&gt;
	&lt;TXDBITEM image=&quot;http://book.daum-img.net/R72x100/ENG9780321356680&quot;&gt;&lt;/TXDBITEM&gt;
&lt;/TXDB&gt;
&lt;!--DB_EMBEDDING_END--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;[업데이트 2013.04.03]&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;한글 목차도 올려봅니다&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;1. 객체의 생성과 소멸&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 1] 생성자 대신 static 팩토리(factory) 메소드 사용을 고려하자&lt;/p&gt;&lt;p&gt;[항목 2] 생성자의 매개변수가 많을 때는 빌더(builder)를 고려하자&lt;/p&gt;&lt;p&gt;[항목 3] private 생성자나 enum 타입을 사용해서 싱글톤의 특성을 유지하자&lt;/p&gt;&lt;p&gt;[항목 4] private 생성자를 사용해서 인스턴스 생성을 못하게 하자&lt;/p&gt;&lt;p&gt;[항목 5] 불필요한 객체의 생성을 피하자&lt;/p&gt;&lt;p&gt;[항목 6] 쓸모 없는 객체 참조를 제거하자&lt;/p&gt;&lt;p&gt;[항목 7] 파이널라이저(finalizer)의 사용을 피하자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;2. 모든 객체에 공통적인 메소드&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 8] equals 메소드를 오버라이딩 할 때는 보편적 계약을 따르자&lt;/p&gt;&lt;p&gt;[항목 9] equals 메소드를 오버라이드 할 때는 hashCode 메소드도 항상 같이 오버라이드 하자&lt;/p&gt;&lt;p&gt;[항목 10] toString 메소드는 항상 오버라이드 하자&lt;/p&gt;&lt;p&gt;[항목 11] clone 메소드는 신중하게 오버라이드 하자&lt;/p&gt;&lt;p&gt;[항목 12] Comparable 인터페이스의 구현을 고려하자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;클래스와 인터페이스&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 13] 클래스와 그 멤버의 접근성을 최소화하자&lt;/p&gt;&lt;p&gt;[항목 14] public 클래스에서는 public 필드가 아닌 접근자(accessor) 메소드를 사용한다&lt;/p&gt;&lt;p&gt;[항목 15] 가변성을 최소화 하자&lt;/p&gt;&lt;p&gt;[항목 16] 가급적 상속(inheritance)보다는 컴포지션(composition)을 사용하자&lt;/p&gt;&lt;p&gt;[항목 17] 상속을 위한 설계와 문서화를 하자. 그렇지 않다면 상속의 사용을 금지시킨다&lt;/p&gt;&lt;p&gt;[항목 18] 추상 클래스보다는 인터페이스를 사용하자&lt;/p&gt;&lt;p&gt;[항목 19] 타입을 정의할 때만 인터페이스를 사용하자&lt;/p&gt;&lt;p&gt;[항목 20] 태그(tagged) 클래스보다는 클래스 계층을 사용하자&lt;/p&gt;&lt;p&gt;[항목 21] 전략을 표현할 때 함수 객체를 사용하자&lt;/p&gt;&lt;p&gt;[항목 22] static 멤버 클래스를 많이 사용하자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;4. 제네릭(Generics)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 23] 새로 작성하는 코드에서는 원천(raw) 타입을 사용하지 말자&lt;/p&gt;&lt;p&gt;[항목 24] 컴파일 경고 메시지가 없게 하자&lt;/p&gt;&lt;p&gt;[항목 25] 배열보다는 List를 사용하자&lt;/p&gt;&lt;p&gt;[항목 26] 제네릭 타입을 애용하자&lt;/p&gt;&lt;p&gt;[항목 27] 제네릭 메소드를 애용하자&lt;/p&gt;&lt;p&gt;[항목 28] 바운드 와일드 카드를 사용해서 API의 유연성을 높이자&lt;/p&gt;&lt;p&gt;[항목 29] 타입 안전이 보장되는 혼성(heterogeneous) 컨테이너의 사용을 고려하자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;5. 열거형(Enum)과 주석(Annotation)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 30] int 상수 대신 enum을 사용하자&lt;/p&gt;&lt;p&gt;[항목 31] 서수(序數) 대신 인스턴스 필드를 사용하자&lt;/p&gt;&lt;p&gt;[항목 32] 비트(bit) 필드 대신 EnumSet을 사용하자&lt;/p&gt;&lt;p&gt;[항목 33] 서수(序數) 인덱스 대신 EnumMap을 사용하자&lt;/p&gt;&lt;p&gt;[항목 34] 인터페이스를 사용해서 확장 가능한 enum을 만들자&lt;/p&gt;&lt;p&gt;[항목 35] 작명 패턴보다는 주석(annotation)을 사용하자&lt;/p&gt;&lt;p&gt;[항목 36] Override 주석을 일관성 있게 사용하자&lt;/p&gt;&lt;p&gt;[항목 37] 타입 정의는 표시 인터페이스를 사용하자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;6. 메소드(method)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 38] 매개 변수가 유효한지 검사하자&lt;/p&gt;&lt;p&gt;[항목 39] 필요하면 방어 복사본을 만들자&lt;/p&gt;&lt;p&gt;[항목 40] 메소드 시그니처를 신중하게 설계하자&lt;/p&gt;&lt;p&gt;[항목 41] 오버로딩(overloading)을 분별력 있게 사용하자&lt;/p&gt;&lt;p&gt;[항목 42] 가변 인자(varargs)를 분별력 있게 사용하자&lt;/p&gt;&lt;p&gt;[항목 43] null대신 비어있는 배열이나 컬렉션을 반환하자&lt;/p&gt;&lt;p&gt;[항목 44] 외부에 제공하는 모든 API 요소에 대해 문서화 주석을 넣자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;7. 프로그래밍 일반&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 45] 지역 변수의 유효 범위를 최소화 하자&lt;/p&gt;&lt;p&gt;[항목 46] 종전의 for 루프보다는 for-each 루프를 사용하자&lt;/p&gt;&lt;p&gt;[항목 47] 라이브러리를 배우고 사용하자&lt;/p&gt;&lt;p&gt;[항목 48] 정확한 계산에는 float나 double 타입을 쓰지 말자&lt;/p&gt;&lt;p&gt;[항목 49] 박스화 기본형보다는 기본형을 사용하자&lt;/p&gt;&lt;p&gt;[항목 50] 다른 타입을 쓸 수 있는 곳에서는 String 사용을 피하자&lt;/p&gt;&lt;p&gt;[항목 51] 문자열 결합의 성능 저하를 주의하자&lt;/p&gt;&lt;p&gt;[항목 52] 객체 참조는 그 객체의 인터페이스 타입으로 하자&lt;/p&gt;&lt;p&gt;[항목 53] 리플렉션보다는 인터페이스를 사용하자&lt;/p&gt;&lt;p&gt;[항목 54] 네이티브 메소드를 분별력 있게 사용하자&lt;/p&gt;&lt;p&gt;[항목 55] 잘 판단해서 최적화하자&lt;/p&gt;&lt;p&gt;[항목 56] 보편화된 작명 규칙을 따르자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;8. 예외(Exceptions)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 57] 예외 상황에서만 예외를 사용하자&lt;/p&gt;&lt;p&gt;[항목 58] 복구 가능 상황에는 checked 예외를 사용하고 런타임 예외는 프로그램 에러에 사용하자&lt;/p&gt;&lt;p&gt;[항목 59] checked 예외의 불필요한 사용을 피하자&lt;/p&gt;&lt;p&gt;[항목 60] 표준 예외를 사용하자&lt;/p&gt;&lt;p&gt;[항목 61] 하위 계층의 예외 처리를 신중하게 하자&lt;/p&gt;&lt;p&gt;[항목 62] 메소드가 던지는 모든 예외를 문서화하자&lt;/p&gt;&lt;p&gt;[항목 63] 실패 상황 정보를 상세 메시지에 포함하자&lt;/p&gt;&lt;p&gt;[항목 64] 실패 원자성을 갖도록 노력하자&lt;/p&gt;&lt;p&gt;[항목 65] 예외를 묵살하지 말자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;9. 동시성(Concurrency)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 66] 공유하는 가변 데이터에 접근 시 동기화하자&lt;/p&gt;&lt;p&gt;[항목 67] 지나친 동기화는 피하자&lt;/p&gt;&lt;p&gt;[항목 68] 스레드 그룹보다는 실행자와 작업을 사용하자&lt;/p&gt;&lt;p&gt;[항목 69] wait와 notify 대신 동시성 유틸리티를 사용하자&lt;/p&gt;&lt;p&gt;[항목 70] 스레드 안전을 문서화 하자&lt;/p&gt;&lt;p&gt;[항목 71] 늦 초기화를 분별력 있게 사용하자&lt;/p&gt;&lt;p&gt;[항목 72] 스레드 스케줄러에 의존하지 말자&lt;/p&gt;&lt;p&gt;[항목 73] 스레드 그룹을 사용하지 말자&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;10.&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;직렬화(Serialization)&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;[항목 74] Serializable 인터페이스를 분별력 있게 구현하자&lt;/p&gt;&lt;p&gt;[항목 75] 독자적인 직렬화 형태의 사용을 고려하자&lt;/p&gt;&lt;p&gt;[항목 76] 방어 가능한 readObject 메소드를 작성하자&lt;/p&gt;&lt;p&gt;[항목 77] 인스턴스 제어에는 readResolve 메소드보다 enum 타입을 사용하자&lt;/p&gt;&lt;p&gt;[항목 78] 직렬화된 인스턴스 대신 직렬화 프록시의 사용을 고려하자&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;div class=&quot;txc-info&quot; id=&quot;txc_book_detail_KOR9788986044768&quot; point=&quot;&quot; style=&quot;clear: both; font-size: 9pt; line-height: 1.5; margin: 0px; padding: 0px; width: 530px; border: medium none; background-image: none; background-attachment: scroll; background-color: transparent; background-position: 0px 0px; background-repeat: repeat repeat;&quot;&gt;&lt;hr style=&quot;margin:0 0 10px;*margin:-7px 0 3px 0; filter:alpha(opacity=10); opacity:0.1; background:none #333333; border:medium none; clear:both; display:block; height:1px; overflow:hidden; padding:0; width:530px;&quot;&gt;&lt;div style=&quot;float:left; margin:0 10px 10px 0; padding:0; position:relative;&quot;&gt;	&lt;a href=&quot;http://book.daum.net/detail/book.do?bookid=KOR9788986044768&quot; target=&quot;_blank&quot;&gt;		&lt;img class=&quot;photo&quot; width=&quot;72&quot; height=&quot;104&quot; src=&quot;http://book.daum-img.net/R72x100/KOR9788986044768&quot; border=&quot;0&quot; onerror=&quot;this.src='http://icon.daum-img.net/editor/db_img_book.gif?rv=1.0.1'&quot;&gt;	&lt;/a&gt;&lt;/div&gt;&lt;h3 style=&quot;font-size:1em;margin:0;padding:0;&quot;&gt;	&lt;a class=&quot;item fn url&quot; href=&quot;http://book.daum.net/detail/book.do?bookid=KOR9788986044768&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none;  border:medium none; position:static;&quot;&gt;이펙티브 자바(EFFECTIVE JAVA)(제2판)&lt;/a&gt;&lt;/h3&gt;&lt;dl class=&quot;book detail&quot; style=&quot;margin:5px 0  0 82px;&quot;&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;저자&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net//search/bookSearch.do?advancedSearchYN=y&amp;amp;author=JOSHUA%20BLOCH&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;JOSHUA BLOCH&lt;/a&gt; 지음&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;출판사&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net/search/bookSearch.do?advancedSearchYN=y&amp;amp;publisher=%EB%8C%80%EC%9B%85&amp;amp;publisherID=PU00384922&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;대웅&lt;/a&gt; &lt;span style=&quot;font-size:1em; height:1%; zoom:1; filter:alpha(opacity=20); opacity:0.2;&quot;&gt;|&lt;/span&gt; 2009-04-13 출간&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;카테고리&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;&lt;a href=&quot;http://book.daum.net/category/book.do?categoryID=KOR33&quot; target=&quot;_blank&quot; style=&quot;text-decoration:none&quot;&gt;컴퓨터/IT&lt;/a&gt;&lt;/dd&gt;	&lt;dt style=&quot;float:left; margin:0; filter:alpha(opacity=50); opacity:0.5; padding:0&quot;&gt;책소개&lt;/dt&gt;	&lt;dd style=&quot;margin-left:60px; padding:0;&quot;&gt;더 명쾌하고, 더 정확하고, 더 강력하고, 재사용 가능한 코드를...&lt;/dd&gt;&lt;/dl&gt;&lt;div style=&quot;margin:5px 5px 0 82px; padding:0;&quot;&gt;	&lt;a href=&quot;http://book.daum.net/detail/book.do?bookid=KOR9788986044768#tab_comp&quot; target=&quot;_blank&quot; style=&quot;float:right&quot;&gt;&lt;img width=&quot;62&quot; height=&quot;22&quot; src=&quot;http://deco.daum-img.net/contents/info/bt_info_compare.gif?rv=1.0.1&quot; border=&quot;0&quot; alt=&quot;가격비교&quot;&gt;&lt;/a&gt;	&lt;strong class=&quot;rating&quot; style=&quot;border-bottom-width:0;font-weight:bold;&quot;&gt;&lt;/strong&gt;&lt;/div&gt;&lt;hr style=&quot;margin:10px 0 0;*margin:3px 0 -7px 0;opacity:0.1;filter:alpha(opacity=10);line-height:0;font-size:0; background:none #333333; border:medium none; clear:both; display:block; height:1px; overflow:hidden; padding:0; width:530px;&quot;&gt;&lt;/div&gt;
&lt;script src=&quot;http://editor.daum.net/view/info/7.0/book.js&quot; charset=&quot;utf-8&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;script src=&quot;http://cia.daum.net/view/book/book/KOR9788986044768.js?callback=txCiaCallback&quot; charset=&quot;utf-8&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;!--DB_EMBEDDING_START--&gt;
&lt;TXDB name=&quot;책&quot; id=&quot;txd_book_detail_KOR9788986044768&quot;&gt;
	&lt;TXDBITEM title=&quot;이펙티브 자바(EFFECTIVE JAVA)(제2판)&quot;&gt;&lt;/TXDBITEM&gt;
	&lt;TXDBITEM image=&quot;http://book.daum-img.net/R72x100/KOR9788986044768&quot;&gt;&lt;/TXDBITEM&gt;
&lt;/TXDB&gt;
&lt;!--DB_EMBEDDING_END--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>Effective Java</category>
      <category>Java</category>
      <category>이펙티브 자바</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/175</guid>
      <comments>https://epicdevsold.tistory.com/175#entry175comment</comments>
      <pubDate>Wed, 3 Apr 2013 01:35:46 +0900</pubDate>
    </item>
    <item>
      <title>Scala foldLeft 예제들</title>
      <link>https://epicdevsold.tistory.com/174</link>
      <description>&lt;p&gt;&lt;a href=&quot;http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://oldfashionedsoftware.com/2009/07/30/lots-and-lots-of-foldleft-examples/&lt;/a&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>foldLeft</category>
      <category>scala</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/174</guid>
      <comments>https://epicdevsold.tistory.com/174#entry174comment</comments>
      <pubDate>Mon, 1 Apr 2013 05:12:12 +0900</pubDate>
    </item>
    <item>
      <title>Java Generics에서 발생하는 Type Erasure</title>
      <link>https://epicdevsold.tistory.com/173</link>
      <description>&lt;p&gt;Java Generics에서 발생하는 Type Erasure에 대해서 잘 설명하고 있는 글&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://javapapers.com/core-java/type-erasure/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://javapapers.com/core-java/type-erasure/&lt;/a&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>Generics</category>
      <category>Java</category>
      <category>type erasure</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/173</guid>
      <comments>https://epicdevsold.tistory.com/173#entry173comment</comments>
      <pubDate>Mon, 25 Mar 2013 10:31:35 +0900</pubDate>
    </item>
    <item>
      <title>Binary search tree, AVL tree, B tree, Red-black tree, AA tree, Skiplist, Max heap, Min heap, Treap, Scapegoat tree, Splay tree 데모 프로그램</title>
      <link>https://epicdevsold.tistory.com/172</link>
      <description>&lt;p&gt;출처:&amp;nbsp;&lt;a href=&quot;http://people.ksp.sk/~kuko/bak/index.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://people.ksp.sk/~kuko/bak/index.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Binary search tree, AVL tree, B tree, Red-black tree, AA tree, Skiplist, Max heap, Min heap, Treap, Scapegoat tree, Splay tree 등의 자료구조들을 직접 동작시켜 볼 수 있는 Java Applet을 제공하는 &lt;a href=&quot;http://people.ksp.sk/~kuko/bak/index.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;사이트&lt;/a&gt;입니다.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;저는 Skiplist를 공부해보려고 자료를 찾다가 발견하게 되었습니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt; line-height: 1.5;&quot;&gt;기초적인 Binary search tree부터 고급 자료구조인 Skiplist나 Splay tree같은 것들도&amp;nbsp;다루고 있습니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 1000px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/254C4D42512DDC5103&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F254C4D42512DDC5103&quot; width=&quot;1000&quot; height=&quot;505&quot; filename=&quot;2013-02-27 19_12_04-Binary Search Trees.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 1000px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2644F042512DDC510E&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2644F042512DDC510E&quot; width=&quot;1000&quot; height=&quot;506&quot; filename=&quot;2013-02-27 19_12_43-Binary Search Trees.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 1000px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2449D842512DDC5207&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2449D842512DDC5207&quot; width=&quot;1000&quot; height=&quot;506&quot; filename=&quot;2013-02-27 19_12_59-Binary Search Trees.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Archive</category>
      <category>AA tree</category>
      <category>avl tree</category>
      <category>B tree</category>
      <category>binary search tree</category>
      <category>Data Structures</category>
      <category>max heap</category>
      <category>Min heap</category>
      <category>Red-black tree</category>
      <category>Scapegoat tree</category>
      <category>Skiplist</category>
      <category>Splay tree</category>
      <category>Treap</category>
      <category>이진트리</category>
      <category>자료구조</category>
      <category>탐색트리</category>
      <author>epicdev</author>
      <guid isPermaLink="true">https://epicdevsold.tistory.com/172</guid>
      <comments>https://epicdevsold.tistory.com/172#entry172comment</comments>
      <pubDate>Wed, 27 Feb 2013 19:14:50 +0900</pubDate>
    </item>
  </channel>
</rss>