<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Optimized Speedy Ajax Code</title>
	<atom:link href="http://ajaxian.com/archives/optimized-speedy-ajax-code/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/optimized-speedy-ajax-code</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Mourner</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256549</link>
		<dc:creator>Mourner</dc:creator>
		<pubDate>Thu, 04 Oct 2007 13:03:05 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256549</guid>
		<description>As others have already pointed out in the article comments, this code doesn&#039;t work at all, because readyState is only checked once before sending the request (instead of polling or putting it on onreadystatechange event)</description>
		<content:encoded><![CDATA[<p>As others have already pointed out in the article comments, this code doesn&#8217;t work at all, because readyState is only checked once before sending the request (instead of polling or putting it on onreadystatechange event)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256540</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 04 Oct 2007 08:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256540</guid>
		<description>@deadcabbit What you say is true, but only if the effect is (near) transparent. In the case of try-catch it isn&#039;t on the iPhone. It literally takes seconds to pass try catch blocks.</description>
		<content:encoded><![CDATA[<p>@deadcabbit What you say is true, but only if the effect is (near) transparent. In the case of try-catch it isn&#8217;t on the iPhone. It literally takes seconds to pass try catch blocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deadcabbit</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256533</link>
		<dc:creator>deadcabbit</dc:creator>
		<pubDate>Thu, 04 Oct 2007 06:04:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256533</guid>
		<description>Am I the only one, who prefers higher level &quot;complexity&quot;? I know that try-catch is slow or that foreach-like syntax is bad for performance, but I prefer to let these things handled by frameworks (either inhouse, or for pet projects prototype.js) - hardware components and browsers are getting faster/better by the day (by the year, sry:)), but code reusability and readibility will not improve by itself.</description>
		<content:encoded><![CDATA[<p>Am I the only one, who prefers higher level &#8220;complexity&#8221;? I know that try-catch is slow or that foreach-like syntax is bad for performance, but I prefer to let these things handled by frameworks (either inhouse, or for pet projects prototype.js) &#8211; hardware components and browsers are getting faster/better by the day (by the year, sry:)), but code reusability and readibility will not improve by itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Pascarello</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256517</link>
		<dc:creator>Eric Pascarello</dc:creator>
		<pubDate>Wed, 03 Oct 2007 22:24:53 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256517</guid>
		<description>@Rogier 
Totally agree with you. Object detection is always the way to go.

My comment is basically why you probably would want to use the around the ActiveX. Talked about the error a long time ago on my blog here: http://radio.javaranch.com/pascarello/2006/02/07/1139345471027.html

Eric</description>
		<content:encoded><![CDATA[<p>@Rogier<br />
Totally agree with you. Object detection is always the way to go.</p>
<p>My comment is basically why you probably would want to use the around the ActiveX. Talked about the error a long time ago on my blog here: <a href="http://radio.javaranch.com/pascarello/2006/02/07/1139345471027.html" rel="nofollow">http://radio.javaranch.com/pascarello/2006/02/07/1139345471027.html</a></p>
<p>Eric</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rogier</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256508</link>
		<dc:creator>Rogier</dc:creator>
		<pubDate>Wed, 03 Oct 2007 21:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256508</guid>
		<description>@Eric

Considering your argument about disabling ActiveX, I&#039;d still narrow the try/catch block down to the ActiveX control construction.

But you simply don&#039;t need to try/catch anything, if ActiveX is disabled and window.XMLHttpRequest doesn&#039;t exist you can perfectly verify that you got what you need without &quot;trying&quot;.</description>
		<content:encoded><![CDATA[<p>@Eric</p>
<p>Considering your argument about disabling ActiveX, I&#8217;d still narrow the try/catch block down to the ActiveX control construction.</p>
<p>But you simply don&#8217;t need to try/catch anything, if ActiveX is disabled and window.XMLHttpRequest doesn&#8217;t exist you can perfectly verify that you got what you need without &#8220;trying&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Pascarello</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256497</link>
		<dc:creator>Eric Pascarello</dc:creator>
		<pubDate>Wed, 03 Oct 2007 19:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256497</guid>
		<description>[quote] I donâ€™t understand why frameworks must use a try/catch (try/catchs are usually not very fast, and very annoying with Firebug).[/quote]

Disable ActiveX and see what happens.</description>
		<content:encoded><![CDATA[<p>[quote] I donâ€™t understand why frameworks must use a try/catch (try/catchs are usually not very fast, and very annoying with Firebug).[/quote]</p>
<p>Disable ActiveX and see what happens.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris Kowal</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256491</link>
		<dc:creator>Kris Kowal</dc:creator>
		<pubDate>Wed, 03 Oct 2007 17:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256491</guid>
		<description>Neglecting the try/catch and micro-optimization accusations for a moment, I started with a similar chunk of code copied from Dojo (dojo/src/hostenv_browser.js) and applied the lazy function pattern as well, except that I managed to refactor some of the logic by using an array of functions.

https://cixar.com/tracs/javascript/browser/trunk/modules.js?rev=136#L1433

Microsoft.XMLHTTP will always get versions up to 3.  Checking for Msxml2.XMLHTTP is a waste of time since it always gets version 3.  Msxml2.XMLHTTP.4.0 and 6.0 are not returned by Microsoft.XMLHTTP.  6.0 was released with Vista.

http://www.telerik.com/documents/AJAX%20Page/Ajax-Part1.pdf page 3

This is a great exercise for the Lazy Function Declaration pattern, if only for its educational value, or because try/catch is expensive.

This sample is pretty green though (in the arboreal sense).  It doesn&#039;t take into account status eccentricities of various browsers over various protocols.  For example KHTML doesn&#039;t mask the 304 cache hit status (other browsers handle it and change it to a 200).  Also in some browsers, under various conditions, you&#039;ll get &quot;undefined&quot; or &quot;0&quot; for OK.</description>
		<content:encoded><![CDATA[<p>Neglecting the try/catch and micro-optimization accusations for a moment, I started with a similar chunk of code copied from Dojo (dojo/src/hostenv_browser.js) and applied the lazy function pattern as well, except that I managed to refactor some of the logic by using an array of functions.</p>
<p><a href="https://cixar.com/tracs/javascript/browser/trunk/modules.js?rev=136#L1433" rel="nofollow">https://cixar.com/tracs/javascript/browser/trunk/modules.js?rev=136#L1433</a></p>
<p>Microsoft.XMLHTTP will always get versions up to 3.  Checking for Msxml2.XMLHTTP is a waste of time since it always gets version 3.  Msxml2.XMLHTTP.4.0 and 6.0 are not returned by Microsoft.XMLHTTP.  6.0 was released with Vista.</p>
<p><a href="http://www.telerik.com/documents/AJAX%20Page/Ajax-Part1.pdf" rel="nofollow">http://www.telerik.com/documents/AJAX%20Page/Ajax-Part1.pdf</a> page 3</p>
<p>This is a great exercise for the Lazy Function Declaration pattern, if only for its educational value, or because try/catch is expensive.</p>
<p>This sample is pretty green though (in the arboreal sense).  It doesn&#8217;t take into account status eccentricities of various browsers over various protocols.  For example KHTML doesn&#8217;t mask the 304 cache hit status (other browsers handle it and change it to a 200).  Also in some browsers, under various conditions, you&#8217;ll get &#8220;undefined&#8221; or &#8220;0&#8243; for OK.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256486</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 03 Oct 2007 17:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256486</guid>
		<description>In fact, try catch blocks have been shown to be extremely slow on certain browsers (the iPhone&#039;s version of Safari for example).</description>
		<content:encoded><![CDATA[<p>In fact, try catch blocks have been shown to be extremely slow on certain browsers (the iPhone&#8217;s version of Safari for example).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris Zyp</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256483</link>
		<dc:creator>Kris Zyp</dc:creator>
		<pubDate>Wed, 03 Oct 2007 16:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256483</guid>
		<description>Ignoring the lazy pattern for a minute, why can&#039;t the XHR object be retrieved with simply:

if (window.XMLHttpRequest)
  return new window.XMLHttpRequest();
else if (window.ActiveXObject)
  return new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);

This what I have used for a long time without any problems. I don&#039;t understand why frameworks must use a try/catch (try/catchs are usually not very fast, and very annoying with Firebug). And why the different ActiveXObjects, the MS specs seem to make it clear that you don&#039;t need to do that (the code above should always resolve to the latest version)? Is this just case of code that has been copied time and time again without question?</description>
		<content:encoded><![CDATA[<p>Ignoring the lazy pattern for a minute, why can&#8217;t the XHR object be retrieved with simply:</p>
<p>if (window.XMLHttpRequest)<br />
  return new window.XMLHttpRequest();<br />
else if (window.ActiveXObject)<br />
  return new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);</p>
<p>This what I have used for a long time without any problems. I don&#8217;t understand why frameworks must use a try/catch (try/catchs are usually not very fast, and very annoying with Firebug). And why the different ActiveXObjects, the MS specs seem to make it clear that you don&#8217;t need to do that (the code above should always resolve to the latest version)? Is this just case of code that has been copied time and time again without question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TimD</title>
		<link>http://ajaxian.com/archives/optimized-speedy-ajax-code/comment-page-1#comment-256479</link>
		<dc:creator>TimD</dc:creator>
		<pubDate>Wed, 03 Oct 2007 15:27:04 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=2847#comment-256479</guid>
		<description>Useless there is little overhead in creating the correct XHR and loading the data over HTTP. There is much more effective result in optimizing the parsing of JSON / XML / etc.</description>
		<content:encoded><![CDATA[<p>Useless there is little overhead in creating the correct XHR and loading the data over HTTP. There is much more effective result in optimizing the parsing of JSON / XML / etc.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

