<?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: Improve LINQ Query Performance</title>
	<atom:link href="http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/</link>
	<description>web development, tech reviews, tips, tricks, blogging</description>
	<lastBuildDate>Mon, 23 Jan 2012 02:28:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: fdumlao</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-893</link>
		<dc:creator>fdumlao</dc:creator>
		<pubDate>Sat, 18 Apr 2009 01:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-893</guid>
		<description>Essentially what you were looking for here was the difference of two collections (myTasks and outlookTasks). Enumerable has a built in method (Except()) to handle these when the collections are of the same type, and LINQ adds the ability to pass in a query to the &quot;Except&quot; method so that you can transform one collection before it is used.&lt;br&gt;&lt;br&gt;Your first approach was O(N^2), iterating over one collection then iterating over the second collection once for each iteration of the first collection.&lt;br&gt;&lt;br&gt;Your second approach is better: O(N) + O(N), which will iterate through collection one, then collection 2. However as the collections get bigger this will begin to take longer, which an optimized intersect algorithm can help you to avoid!&lt;br&gt;&lt;br&gt;if you instead used:&lt;br&gt;&lt;br&gt;Dim results = _&lt;br&gt;        myTasks.Except(From outlookTask In outlookTasks _&lt;br&gt;                                           Select outlookTask.Subject)&lt;br&gt;&lt;br&gt;which I believe is implemented as O(N log N) which should nicely plateau and provide reliable performance even as the collections get larger, not to mention fewer lines of code!&lt;br&gt;&lt;br&gt;Hope this helped!</description>
		<content:encoded><![CDATA[<p>Essentially what you were looking for here was the difference of two collections (myTasks and outlookTasks). Enumerable has a built in method (Except()) to handle these when the collections are of the same type, and LINQ adds the ability to pass in a query to the &#8220;Except&#8221; method so that you can transform one collection before it is used.</p>
<p>Your first approach was O(N^2), iterating over one collection then iterating over the second collection once for each iteration of the first collection.</p>
<p>Your second approach is better: O(N) + O(N), which will iterate through collection one, then collection 2. However as the collections get bigger this will begin to take longer, which an optimized intersect algorithm can help you to avoid!</p>
<p>if you instead used:</p>
<p>Dim results = _<br />        myTasks.Except(From outlookTask In outlookTasks _<br />                                           Select outlookTask.Subject)</p>
<p>which I believe is implemented as O(N log N) which should nicely plateau and provide reliable performance even as the collections get larger, not to mention fewer lines of code!</p>
<p>Hope this helped!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fdumlao</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-801</link>
		<dc:creator>fdumlao</dc:creator>
		<pubDate>Fri, 17 Apr 2009 18:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-801</guid>
		<description>Essentially what you were looking for here was the difference of two collections (myTasks and outlookTasks). Enumerable has a built in method (Except()) to handle these when the collections are of the same type, and LINQ adds the ability to pass in a query to the &quot;Except&quot; method so that you can transform one collection before it is used.&lt;br&gt;&lt;br&gt;Your first approach was O(N^2), iterating over one collection then iterating over the second collection once for each iteration of the first collection.&lt;br&gt;&lt;br&gt;Your second approach is better: O(N) + O(N), which will iterate through collection one, then collection 2. However as the collections get bigger this will begin to take longer, which an optimized intersect algorithm can help you to avoid!&lt;br&gt;&lt;br&gt;if you instead used:&lt;br&gt;&lt;br&gt;Dim results = _&lt;br&gt;        myTasks.Except(From outlookTask In outlookTasks _&lt;br&gt;                                           Select outlookTask.Subject)&lt;br&gt;&lt;br&gt;which I believe is implemented as O(N log N) which should nicely plateau and provide reliable performance even as the collections get larger, not to mention fewer lines of code!&lt;br&gt;&lt;br&gt;Hope this helped!</description>
		<content:encoded><![CDATA[<p>Essentially what you were looking for here was the difference of two collections (myTasks and outlookTasks). Enumerable has a built in method (Except()) to handle these when the collections are of the same type, and LINQ adds the ability to pass in a query to the &#8220;Except&#8221; method so that you can transform one collection before it is used.</p>
<p>Your first approach was O(N^2), iterating over one collection then iterating over the second collection once for each iteration of the first collection.</p>
<p>Your second approach is better: O(N) + O(N), which will iterate through collection one, then collection 2. However as the collections get bigger this will begin to take longer, which an optimized intersect algorithm can help you to avoid!</p>
<p>if you instead used:</p>
<p>Dim results = _<br />        myTasks.Except(From outlookTask In outlookTasks _<br />                                           Select outlookTask.Subject)</p>
<p>which I believe is implemented as O(N log N) which should nicely plateau and provide reliable performance even as the collections get larger, not to mention fewer lines of code!</p>
<p>Hope this helped!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aquiaqui</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-774</link>
		<dc:creator>aquiaqui</dc:creator>
		<pubDate>Fri, 06 Feb 2009 16:02:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-774</guid>
		<description>thanks!</description>
		<content:encoded><![CDATA[<p>thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emad Ibrahim</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-123</link>
		<dc:creator>Emad Ibrahim</dc:creator>
		<pubDate>Thu, 06 Mar 2008 15:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-123</guid>
		<description>Ed, thanks for the tip, I will give it a shot and report back.</description>
		<content:encoded><![CDATA[<p>Ed, thanks for the tip, I will give it a shot and report back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emad Ibrahim</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-419</link>
		<dc:creator>Emad Ibrahim</dc:creator>
		<pubDate>Thu, 06 Mar 2008 12:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-419</guid>
		<description>Ed, thanks for the tip, I will give it a shot and report back.</description>
		<content:encoded><![CDATA[<p>Ed, thanks for the tip, I will give it a shot and report back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed Richard</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-122</link>
		<dc:creator>Ed Richard</dc:creator>
		<pubDate>Thu, 06 Mar 2008 10:05:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-122</guid>
		<description>I&#039;m wondering Emad, have you considered optimizing using the new GetTable method on the folder class?

Ed</description>
		<content:encoded><![CDATA[<p>I&#8217;m wondering Emad, have you considered optimizing using the new GetTable method on the folder class?</p>
<p>Ed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed Richard</title>
		<link>http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/comment-page-1/#comment-418</link>
		<dc:creator>Ed Richard</dc:creator>
		<pubDate>Thu, 06 Mar 2008 07:05:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.emadibrahim.com/2008/02/19/improve-linq-query-performance/#comment-418</guid>
		<description>I&#039;m wondering Emad, have you considered optimizing using the new GetTable method on the folder class?&lt;br&gt;&lt;br&gt;Ed</description>
		<content:encoded><![CDATA[<p>I&#8217;m wondering Emad, have you considered optimizing using the new GetTable method on the folder class?</p>
<p>Ed</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
