<?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: jQuery and Performance: What is &#8216;this&#8217;?</title>
	<atom:link href="http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/</link>
	<description>Web Developer&#039;s Ramblings on JavaScript, jQuery, ColdFusion, MySQL, and other technologies.</description>
	<lastBuildDate>Wed, 08 Sep 2010 15:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Tim Branyen</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1946</link>
		<dc:creator>Tim Branyen</dc:creator>
		<pubDate>Tue, 02 Feb 2010 16:03:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1946</guid>
		<description>Regarding premature optimization, I don&#039;t think anyone is claiming to refactor code to use this approach.  I do, however, feel its prudent as a client side coder to know where performance can be improved, without taking away from the readability.  While many of us are on quad core machines that show minute differences with events.  Its very likely a user could be on an older machine that stands to gain.  

I agree with premature optimization being an unnecessary step in the development cycle, but with this new knowledge, it instead becomes good practice.

I also noticed through some testing of my own that getElementsByTagName performed faster than access forms and images through dot-notation.</description>
		<content:encoded><![CDATA[<p>Regarding premature optimization, I don&#8217;t think anyone is claiming to refactor code to use this approach.  I do, however, feel its prudent as a client side coder to know where performance can be improved, without taking away from the readability.  While many of us are on quad core machines that show minute differences with events.  Its very likely a user could be on an older machine that stands to gain.  </p>
<p>I agree with premature optimization being an unnecessary step in the development cycle, but with this new knowledge, it instead becomes good practice.</p>
<p>I also noticed through some testing of my own that getElementsByTagName performed faster than access forms and images through dot-notation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JAlpino</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1799</link>
		<dc:creator>JAlpino</dc:creator>
		<pubDate>Mon, 11 Jan 2010 23:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1799</guid>
		<description>Like any type of app development, it&#039;s best not to get caught up in pre-mature optimization. So @Adam, if your app is not heavy on the client side, then taking optimization steps such as using the dom properties directly vs. jQuery calls, then it might not make sense to switch. However, if that&#039;s not the case then applying these performance measures will help, even if the calls span over time rather than all at once.</description>
		<content:encoded><![CDATA[<p>Like any type of app development, it&#8217;s best not to get caught up in pre-mature optimization. So @Adam, if your app is not heavy on the client side, then taking optimization steps such as using the dom properties directly vs. jQuery calls, then it might not make sense to switch. However, if that&#8217;s not the case then applying these performance measures will help, even if the calls span over time rather than all at once.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Koch</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1796</link>
		<dc:creator>Adam Koch</dc:creator>
		<pubDate>Mon, 11 Jan 2010 14:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1796</guid>
		<description>Sure, but this is for 20-50k times. I don&#039;t have any functions that are called that many times.</description>
		<content:encoded><![CDATA[<p>Sure, but this is for 20-50k times. I don&#8217;t have any functions that are called that many times.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonas De Smet</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1788</link>
		<dc:creator>Jonas De Smet</dc:creator>
		<pubDate>Sat, 09 Jan 2010 11:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1788</guid>
		<description>Wow, thanks for the great tip, there were a couple of things I didn&#039;t know!</description>
		<content:encoded><![CDATA[<p>Wow, thanks for the great tip, there were a couple of things I didn&#8217;t know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean Hall</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1787</link>
		<dc:creator>Dean Hall</dc:creator>
		<pubDate>Sat, 09 Jan 2010 04:43:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1787</guid>
		<description>Seeing all the qualifiers, this seems to prove the point that jQuery (and other, similar libraries) is invaluable to developers writing cross-browser JS. Thanks for the reminder, though, that libraries also invisibly add cycles. It won&#039;t affect us much when developing sites with minimal JS that&#039;s executed once or even on occasional user interaction, but when writing complex web apps, knowing how to optimize the code that gets executed repeatedly will save your users lots of headaches.</description>
		<content:encoded><![CDATA[<p>Seeing all the qualifiers, this seems to prove the point that jQuery (and other, similar libraries) is invaluable to developers writing cross-browser JS. Thanks for the reminder, though, that libraries also invisibly add cycles. It won&#8217;t affect us much when developing sites with minimal JS that&#8217;s executed once or even on occasional user interaction, but when writing complex web apps, knowing how to optimize the code that gets executed repeatedly will save your users lots of headaches.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kartik Sehgal</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1780</link>
		<dc:creator>Kartik Sehgal</dc:creator>
		<pubDate>Fri, 08 Jan 2010 06:16:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1780</guid>
		<description>@Eric Thanks for sharing this information. I was not sure if getAttribute was faster on all the browsers, but I too faced problems similar to the ones mentioned in http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/ when trying to use getAttribute and setAttributes while sorting list boxes.</description>
		<content:encoded><![CDATA[<p>@Eric Thanks for sharing this information. I was not sure if getAttribute was faster on all the browsers, but I too faced problems similar to the ones mentioned in <a href="http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/" rel="nofollow">http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/</a> when trying to use getAttribute and setAttributes while sorting list boxes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Hynds</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1778</link>
		<dc:creator>Eric Hynds</dc:creator>
		<pubDate>Thu, 07 Jan 2010 23:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1778</guid>
		<description>Wow, I cannot believe getAttribute() is that much faster... I&#039;ve added this benchmark to my original post.  I did some research and found a good post on the differences between this.property and this.getAttribute(): http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/

As it turns out, getAttribute() will return the string value set in the original markup regardless if it is changed later by JS.  this.property notation returns the current value.  Just something to be careful of...</description>
		<content:encoded><![CDATA[<p>Wow, I cannot believe getAttribute() is that much faster&#8230; I&#8217;ve added this benchmark to my original post.  I did some research and found a good post on the differences between this.property and this.getAttribute(): <a href="http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/" rel="nofollow">http://updatepanel.wordpress.com/2008/12/31/more-on-getattribute-setattribute-and-the-value-attribute/</a></p>
<p>As it turns out, getAttribute() will return the string value set in the original markup regardless if it is changed later by JS.  this.property notation returns the current value.  Just something to be careful of&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JAlpino</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1777</link>
		<dc:creator>JAlpino</dc:creator>
		<pubDate>Thu, 07 Jan 2010 22:30:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1777</guid>
		<description>@Kartik Just wanted to point out that you can use the getAttribute() and setAttribute() methods on the dom node to get around the lack of a &#039;public&#039; property such as &#039;for&#039; on a label. 

Another interesting point is that in all browsers that I tested this on; FF(3.5.6), Chrome(3.0.195.38) and IE(8.0.6001.18702), getAttribute() performed much better (4x) than straight object.property notation.

Add the following profile statement to the first test:
&lt;pre lang=&quot;javascript&quot;&gt;
profile(&#039;vanilla javascript using getAttribute()&#039;, function(){
			href = self.getAttribute(&quot;href&quot;);
		});	
&lt;/pre&gt;

** setAttribute() on the hand, had mixed results. In FF in ran in the same time as the object.property = &#039;value&#039;; notation, but in Chrome and in IE it was much slower.</description>
		<content:encoded><![CDATA[<p>@Kartik Just wanted to point out that you can use the getAttribute() and setAttribute() methods on the dom node to get around the lack of a &#8216;public&#8217; property such as &#8216;for&#8217; on a label. </p>
<p>Another interesting point is that in all browsers that I tested this on; FF(3.5.6), Chrome(3.0.195.38) and IE(8.0.6001.18702), getAttribute() performed much better (4x) than straight object.property notation.</p>
<p>Add the following profile statement to the first test:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">profile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'vanilla javascript using getAttribute()'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			href <span style="color: #339933;">=</span> self.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>** setAttribute() on the hand, had mixed results. In FF in ran in the same time as the object.property = &#8216;value&#8217;; notation, but in Chrome and in IE it was much slower.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Hynds</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1776</link>
		<dc:creator>Eric Hynds</dc:creator>
		<pubDate>Thu, 07 Jan 2010 21:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1776</guid>
		<description>@JAlpino nice!  This calls for a graph, I&#039;ll have to whip one up.  I&#039;m real surprised there was no improvement in Chrome using jQuery vs. JavaScript.

@Kartik good point.  It&#039;s harder to see what is available to &#039;this&#039; because, unlike a jQuery collection, logging it to the console doesn&#039;t reveal it&#039;s properties.</description>
		<content:encoded><![CDATA[<p>@JAlpino nice!  This calls for a graph, I&#8217;ll have to whip one up.  I&#8217;m real surprised there was no improvement in Chrome using jQuery vs. JavaScript.</p>
<p>@Kartik good point.  It&#8217;s harder to see what is available to &#8216;this&#8217; because, unlike a jQuery collection, logging it to the console doesn&#8217;t reveal it&#8217;s properties.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kartik Sehgal</title>
		<link>http://www.erichynds.com/jquery/jquery-and-performance-what-is-this/#comment-1766</link>
		<dc:creator>Kartik Sehgal</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:59:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.erichynds.com/?p=173#comment-1766</guid>
		<description>Nice Article! One limitation of using this directly is that the number of attributes supported are very minimal. Take the label tag for instance. It has an attribute &quot;for&quot;. this.for does not execute. In fact it gives a JavaScript error. Then there is also a question of consistency. It will take greater effort in ensuring that this is being used directly correctly, especially when working in large teams.</description>
		<content:encoded><![CDATA[<p>Nice Article! One limitation of using this directly is that the number of attributes supported are very minimal. Take the label tag for instance. It has an attribute &#8220;for&#8221;. this.for does not execute. In fact it gives a JavaScript error. Then there is also a question of consistency. It will take greater effort in ensuring that this is being used directly correctly, especially when working in large teams.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
