<?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>Ajax Bestiary &#187; performance</title>
	<atom:link href="http://www.ajaxbestiary.com/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxbestiary.com</link>
	<description>AJAX Development, News, Techniques &#38; More</description>
	<lastBuildDate>Wed, 01 Feb 2012 12:46:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Implicit Vs. Explicit Conversion in Javascript</title>
		<link>http://www.ajaxbestiary.com/2008/01/14/implicit-vs-explicit-conversion-in-javascript/</link>
		<comments>http://www.ajaxbestiary.com/2008/01/14/implicit-vs-explicit-conversion-in-javascript/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 13:13:59 +0000</pubDate>
		<dc:creator>Don Albrecht</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tips & tricks]]></category>

		<guid isPermaLink="false">http://www.ajaxbestiary.com/2008/01/14/implicit-vs-explicit-conversion-in-javascript/</guid>
		<description><![CDATA[A question emerged out of my boredom on my flight yesterday.  Which is faster, implicit vs explicit conversion.  Most javascript developers use implicit conversion out of habit. For example: !!x; instead of Boolean( x ); and x + &#8220;&#8221;; instead of String( x);.  I decided to try an experiment for myself and record the performance [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>A question emerged out of my boredom on my flight yesterday.  Which is faster, implicit vs explicit conversion.  Most javascript developers use implicit conversion out of habit. For example:</p>
<p>!!x; instead of Boolean( x ); and x + &#8220;&#8221;; instead of String( x);.  </p>
<p>I decided to try an experiment for myself and record the performance of casting a number to a Boolean or String on my Windows box in Safari 3, Firefox 2, Opera 9 and IE 7.</p>
<p><strong>The Verdict:</strong></p>
<p>Implicit conversion wins handily, demonstrating over a 7 fold performance increase in one test. Overall, the performance gain for using implicit conversion averaged out to 53% across browsers after 10 tests. </p>
<p><strong>The Numbers: </strong></p>
<table cellspacing="0" cellpadding="2" width="400" border="1">
<tbody>
<tr>
<td valign="top" width="112"> </td>
<td valign="top" width="53">Implicit Boolean</td>
<td valign="top" width="80">Explicit Boolean</td>
<td valign="top" width="75">Implicit String</td>
<td valign="top" width="74">Explicit String</td>
</tr>
<tr>
<td valign="top" width="112">Firefox 2</td>
<td valign="top" width="53">0.162</td>
<td valign="top" width="80">0.312</td>
<td valign="top" width="74">0.248</td>
<td valign="top" width="74">0.358</td>
</tr>
<tr>
<td valign="top" width="112">IE 7</td>
<td valign="top" width="53">0.042</td>
<td valign="top" width="80">0.100</td>
<td valign="top" width="74">0.074</td>
<td valign="top" width="74">0.152</td>
</tr>
<tr>
<td valign="top" width="112">Opera 9</td>
<td valign="top" width="53">0.030</td>
<td valign="top" width="80">0.088</td>
<td valign="top" width="74">0.020</td>
<td valign="top" width="74">0.142</td>
</tr>
<tr>
<td valign="top" width="112">Safari 3</td>
<td valign="top" width="53">0.028</td>
<td valign="top" width="80">0.036</td>
<td valign="top" width="74">0.074</td>
<td valign="top" width="74">0.100</td>
</tr>
<tr>
<td valign="bottom" width="112"><em>Cross Browser Average</em></td>
<td valign="bottom" width="53"><em>0.066</em></td>
<td valign="bottom" width="81"><em>0.134</em></td>
<td valign="bottom" width="75"><em>0.104</em></td>
<td valign="bottom" width="75"><em>0.188</em></td>
</tr>
</tbody>
</table>
<p>You can find the code I used after the jump.</p>
<p><span id="more-309"></span></p>
<p><strong>The Code:</strong></p>
<p>&lt;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.01 Transitional//EN&#8221;&gt;<br />&lt;html&gt;<br />  &lt;head&gt;<br />  &lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html; charset=windows-1250&#8243;&gt;<br />  &lt;meta name=&#8221;generator&#8221; content=&#8221;PSPad editor, www.pspad.com&#8221;&gt;<br />  &lt;title&gt;&lt;/title&gt;<br />  &lt;script type=&#8221;text/javascript&#8221;&gt;<br />  // JavaScript Document</p>
<p>var implicitBoolean, explicitBoolean, implicitString, explicitString, startDate, endDate;</p>
<p>implicitBoolean = explicitBoolean = implicitString = explicitString = 0;</p>
<p>for( i = 0; i &lt; 500; i++ ){</p>
<p>startDate= new Date();<br />for( i=0; i &lt; 32000; i++){ Boolean( i );} <br />endDate = new Date();<br />explicitBoolean += ( endDate &#8211; startDate );<br />startDate= new Date();<br />for( i=0; i &lt; 32000; i++){ !!i;} <br />endDate = new Date();<br />implicitBoolean += ( endDate &#8211; startDate );</p>
<p>startDate= new Date();<br />for( i=0; i &lt; 32000; i++){ String( i );} <br />endDate = new Date();<br />explicitString += ( endDate &#8211; startDate );</p>
<p>startDate= new Date();<br />for( i=0; i &lt; 32000; i++){ i + &#8220;&#8221;;} <br />endDate = new Date();<br />implicitString += ( endDate &#8211; startDate );<br />}</p>
<p>document.writeln( &#8220;Implicit Boolean:  &#8221; + (implicitBoolean / 500 ) + &#8220;&lt;br /&gt;&#8221; );<br />document.writeln( &#8220;Explicit Boolean:  &#8221; + (explicitBoolean / 500 ) + &#8220;&lt;br /&gt;&#8221; );<br />document.writeln( &#8220;Implicit String:  &#8221; + (implicitString / 500 ) + &#8220;&lt;br /&gt;&#8221; );<br />document.writeln( &#8220;Explicit String:  &#8221; + (explicitString / 500 ) + &#8220;&lt;br /&gt;&#8221; );<br />  &lt;/script&gt;<br />  &lt;/head&gt;<br />  &lt;body&gt;</p>
<p>  &lt;/body&gt;<br />&lt;/html&gt;</p>
<p><img src="http://www.ajaxbestiary.com/?voyeur=1"></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://www.ajaxbestiary.com/2008/01/14/implicit-vs-explicit-conversion-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FastInit: SuperCharge Your Pageloads</title>
		<link>http://www.ajaxbestiary.com/2007/11/27/fastinit-supercharge-your-pageloads/</link>
		<comments>http://www.ajaxbestiary.com/2007/11/27/fastinit-supercharge-your-pageloads/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 14:47:31 +0000</pubDate>
		<dc:creator>Don Albrecht</dc:creator>
				<category><![CDATA[Misc Toolkits]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Library]]></category>
		<category><![CDATA[Load]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.ajaxbestiary.com/2007/11/27/fastinit-supercharge-your-pageloads/</guid>
		<description><![CDATA[What is it: FastInit is a small JS file to create a Faster window.onload. It implements a powerful onload function queue that fires once teh dom is ready and before all images have been downloaded. Ideally, this results in a dramatic decrease in a pages initialization time. How it Works You any functions to the [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p><strong>What is it: </strong></p>
<p>FastInit is a small JS file to create a Faster window.onload.  It implements a powerful onload function queue that fires once teh dom is ready and before all images have been downloaded.  Ideally, this results in a dramatic decrease in a pages initialization time.</p>
<p><strong>How it Works </strong></p>
<p>You any functions to the queue by using the FastInit.addOnLoad( function 1, function 2, &#8230;); function.  All functions are fired in the order in which they were added to the queue.  addOnLoad can be called as many times as is necessary.  It fails gracefully to standard handlers if the browser doesn&#8217;t support the faster methods.</p>
<p><strong>Requirements </strong></p>
<p>As of version 1.4.1 the need for Prototype has been removed freeing the code for use in any project where a speedy onload method is needed.</p>
<p>Check it out here:</p>
<p>http://tetlaw.id.au/view/javascript/fastinit</p>
<p><img src="http://www.ajaxbestiary.com/?voyeur=1"></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://www.ajaxbestiary.com/2007/11/27/fastinit-supercharge-your-pageloads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Streamline Your Javascript with Shorthand</title>
		<link>http://www.ajaxbestiary.com/2007/11/02/streamline-your-javascript-with-shorthand/</link>
		<comments>http://www.ajaxbestiary.com/2007/11/02/streamline-your-javascript-with-shorthand/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 12:19:55 +0000</pubDate>
		<dc:creator>Don Albrecht</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[shorthand]]></category>

		<guid isPermaLink="false">http://www.ajaxbestiary.com/2007/11/02/streamline-your-javascript-with-shorthand/</guid>
		<description><![CDATA[D&#8217;bug has published a wonderful list of techniques for abbreviating Javascript and improving performance. You can find the article here: http://blog.reindel.com/2007/11/01/javascript-shorthand-tips-and-tricks/]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>D&#8217;bug has published a wonderful list of techniques for abbreviating Javascript and improving performance.</p>
<p>You can find the article here:</p>
<p><a title="http://blog.reindel.com/2007/11/01/javascript-shorthand-tips-and-tricks/" href="http://blog.reindel.com/2007/11/01/javascript-shorthand-tips-and-tricks/">http://blog.reindel.com/2007/11/01/javascript-shorthand-tips-and-tricks/</a></p>
<p><img src="http://www.ajaxbestiary.com/?voyeur=1"></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://www.ajaxbestiary.com/2007/11/02/streamline-your-javascript-with-shorthand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

