<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Idle Hacking &#187; Performance</title>
	<atom:link href="http://www.idle-hacking.com/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.idle-hacking.com</link>
	<description>Ruby, XUL/Javascript, C/C++, and more...</description>
	<lastBuildDate>Tue, 11 May 2010 02:15:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CSS Performance tips and Internet Explorer</title>
		<link>http://www.idle-hacking.com/2009/01/css-performance-tips-and-internet-explorer/</link>
		<comments>http://www.idle-hacking.com/2009/01/css-performance-tips-and-internet-explorer/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 18:34:20 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[zoom:1]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/?p=482</guid>
		<description><![CDATA[I thought it might be useful to share some techniques I&#8217;ve started to adopt when building a website&#8217;s CSS. These range from reducing the number of requests to keeping it easy to develop for multiple browsers. Performance topics: Technique 1: First know, your CSS less is always better. For example, a lot of times I [...]]]></description>
			<content:encoded><![CDATA[<p>I thought it might be useful to share some techniques I&#8217;ve started to adopt when building a website&#8217;s CSS.  These range from reducing the number of requests to keeping it easy to develop for multiple browsers.</p>
<p><strong>Performance topics:</strong></p>
<p><strong>Technique 1:</strong><br />
First know, your CSS less is always better.  For example, a lot of times I find myself writing:</p>
<pre lang="css">margin-left:0px;
margin-right:10px;
margin-top:5px;
margin-bottom:8px;</pre>
<p>This can be converted to:</p>
<pre lang="css">margin: 0px 10px 5px 8px; /* top, left, bottom, right */</pre>
<p>Doing this can reduce the size of your CSS file, making it load faster.<br />
<span id="more-482"></span><br />
<strong>Technique 2:</strong><br />
Use conditional comments to support IE a slightly modified approach to including a separate style sheet.  Typically, you will see people import a completely new CSS file.  For example, this is what blueprint suggests.</p>
<pre lang="html">
<!--[if IE]>
<link rel="stylesheet" href="ie.css" mce_href="ie.css" type="text/css" media="screen" /><![endif]--></pre>
<p>This works great, but IE takes a performance penalty, because it has to make 2 requests instead of one.  Think about this for a second and it&#8217;s even worse when you consider IE 6 already limits the number of concurrent requests to 2.  Let&#8217;s say your screen.css includes a graphic, either that image will be queued up behind the ie.css or ie.css will be queued up behind that graphic.  Either, way it&#8217;ll degrade an already slowish browser.  It&#8217;s great to want to focus on the new browsers, but consider your users for a minute and realize that they might not point the finger at the browser as you&#8217;d like and instead at you and your application. Keeping that in mind, we can deal with internet explorer and still provide an optimal experience to our users, by putting into use 2 features.  One conditional comment, and two CSS selectors.  If instead of including the second style sheet we copy the contents of ie.css into the bottom of screen.css, making the following changes:</p>
<pre lang="css">/* ie.css */
body {text-align:center;}
.container {text-align:left;}
* html .ie .column {overflow-x:hidden;}
* html .ie legend {margin:-18px -8px 16px 0;padding:0;}
.ie ol {margin-left:2em;}
.ie sup {vertical-align:text-top;}
.ie sub {vertical-align:text-bottom;}
html&gt;body .ie p code {*white-space:normal;}
.ie hr {margin:-8px auto 11px;}</pre>
<p>Now each of the original IE specific rules are targeted at IE only.  We have only one other issue to solve, how to include an &#8220;ie&#8221; class name in our DOM without exposing it to our other browsers.  The solution:  conditional comments.</p>
<pre lang="html">
  <!--[if IE]>
<div class="ie"><![endif]-->
    <!--[if lt IE 7.]>
<div class="ie6"><![endif]-->

     Your site content goes here

    <!--[if lt IE 7.]></div>

<![endif]-->
  <!--[if IE]></div>

<![endif]--></pre>
<p>This adds the DOM elements .ie and .ie6, for internet explorer 6 and .ie for 7 and leaves them out for gecko, webkit, and opera.   From this technique we got one less HTTP request and easier way to manage IE compatibility in our CSS documents.</p>
<p><strong>Technique 3:</strong><br />
Improving IE CSS can be painful.  One of the simplest additions to blueprint is to use zoom:1  effectively.   First off, what is zoom:1? zoom is a property supported by IE that allows you to zoom an element.  zoom:1 has the effect of giving the element layout, making it appear on the page.  Generally, if you don&#8217;t see an element or region of your page after floating another element left or right.  Zoom the elements parent will trigger it to reappear.   Here&#8217;s what I add to my ie.css:</p>
<pre lang="css">.ie div { zoom:1; }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2009/01/css-performance-tips-and-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>overlapping io for mongrel-esi</title>
		<link>http://www.idle-hacking.com/2008/06/overlapping-io-for-mongrel-esi/</link>
		<comments>http://www.idle-hacking.com/2008/06/overlapping-io-for-mongrel-esi/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 13:26:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ESI]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Threads]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2008/06/overlapping-io-for-mongrel-esi/</guid>
		<description><![CDATA[I&#8217;ve been doing a little work on mongrel-esi to improve it&#8217;s concurrency. Here&#8217;s a little test script I wrote to verify some of my thinking. The tricky part, is keeping all the bytes in the correct order, while still requesting as much as possible in parallel. Here&#8217;s my thinking at the moment. # reading a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a little work on <a href="http://code.google.com/p/mongrel-esi">mongrel-esi</a> to improve it&#8217;s concurrency.  Here&#8217;s a little test script I wrote to verify some of my thinking.  The tricky part, is keeping all the bytes in the correct order, while still requesting as much as possible in parallel.  Here&#8217;s my thinking at the moment.<br />
<span id="more-121"></span></p>
<pre lang="ruby">
# reading a file
# as we read and encounter <esi:include src="/foo"/>
# spawn a thread and simulate requesting, but continue parsing the file looking for more on the main thread
# tweak the sleep calls to get different behavior...
require 'thread'

# define a sample buffer here:
input_stream = %Q(
  hello there world

  <esi:include src='/foo/'/>

  some more bytes here

  <esi:include src='/bar/'/>

  and some more here
)

# lets read line by line

count = 0
output = []
back_buffer = []
lock = Mutex.new
in_request = false
requesting = []
last_out = 0

input_stream.split("\n").each do|line|
  if line.match(/<esi:/)
    lock.synchronize do
      in_request = true
      back_buffer[count] = nil # reserve a location in back_buffer
    end
    requesting << Thread.new(count) do|id|
      sleep 0.4 # some busy work
      lock.synchronize do
        back_buffer[id] = "#{id}: sample"
        in_request = false
      end
    end
  else
    sleep 0.1
    lock.synchronize do
      if in_request
        puts "buffering lines..."
        back_buffer[count] = "#{count}: #{line}"
      else
        # roll up requests
        puts "roll up requests..."
        i = 0
        until i == count
          o = back_buffer.shift
          output << o unless o.nil?
          i += 1
        end
        output << "#{count}: #{line}"
        last_out = count # mark the last buffer in back_buffer to be sent
      end
    end
  end
  count += 1
end
requesting.each do|t|
  t.join
end
# roll up requests
while !back_buffer.empty?
  o = back_buffer.shift
  output << o unless o.nil?
end

puts back_buffer.inspect
puts output.join("\n")
</pre>
<p>One obvious issue with this implementation is the number of threads per request is bounded by the response document.<br />
<strong>Update:</strong> I've checked <a href="http://code.google.com/p/mongrel-esi/source/browse/trunk/request-pipe-line.rb">the above into svn</a>, with a few updates</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2008/06/overlapping-io-for-mongrel-esi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE 6 image caching bug</title>
		<link>http://www.idle-hacking.com/2006/01/ie-6-image-caching-bug/</link>
		<comments>http://www.idle-hacking.com/2006/01/ie-6-image-caching-bug/#comments</comments>
		<pubDate>Sun, 29 Jan 2006 21:04:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2006/01/ie-6-image-caching-bug/</guid>
		<description><![CDATA[&#8220;Here’s the problem: Internet Explorer forgets to look into its own cache when inserting HTML via JavaScript DOM manipulation (read: if you use img tags or any tags with CSS background images, Internet Explorer will always try to redownload these images). Read the detailed account on this. Microsoft says it’s designed that way. Well, Sure. [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Here’s the problem: Internet Explorer forgets to look into its own cache when inserting HTML via JavaScript DOM manipulation (read: if you use img tags or any tags with CSS background images, Internet Explorer will always try to redownload these images). <a href="http://mir.aculo.us/articles/2005/08/28/internet-explorer-and-ajax-image-caching-woes">Read the detailed account on this.</a></p>
<p>Microsoft says it’s designed that way. Well, Sure.</p>
<p>&#8220;There’s an other bug in Intenet Explorer (unrelated?) that causes caching of images in CSS only happen with relative paths, so never use background-image:url(/images/blah.png) but do a background-image:url(../images/blah.png), relative to the path your CSS file is in.&#8221;</p>
<p>It&#8217;s an older article, but hopefully has a little of something for everyone.  &#8211;&gt; Speaking loudly against IE is only in our interest as consumers and users of the web! <img src='http://www.idle-hacking.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Update:</strong> More details about IE caching bug can be found here: http://www.ahinea.com/en/tech/ie-dhtml-image-caching.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2006/01/ie-6-image-caching-bug/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
