<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx</link><description>&amp;#160;&amp;#160;&amp;#160;&amp;#160; To achieve best performance you need to make decisions based on trade-off between coolness, coding productivity, and personal engineering values. I never thought I would be recommending my customer considering using old fashion</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Best ASP.NET Performance Winner For Data Binding</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8793359</link><pubDate>Thu, 31 Jul 2008 17:15:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793359</guid><dc:creator>DotNetKicks.com</dc:creator><description>&lt;p&gt;You've been kicked (a good thing) - Trackback from DotNetKicks.com&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8793400</link><pubDate>Thu, 31 Jul 2008 17:46:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793400</guid><dc:creator>James</dc:creator><description>&lt;p&gt;Really nice. &amp;nbsp;I love how thorough you were in the investigation and in reporting the results.&lt;/p&gt;
&lt;p&gt;Thanks for taking the time to put this together.&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8794179</link><pubDate>Thu, 31 Jul 2008 21:36:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8794179</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;James, great to hear you found this useful&lt;/p&gt;
</description></item><item><title>ASP.NET Data Binding Performance – Collection Is More Expensive Than Datatable</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8798953</link><pubDate>Fri, 01 Aug 2008 14:19:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8798953</guid><dc:creator>Alik Levin's</dc:creator><description>&lt;p&gt;&amp;amp;#160;&amp;amp;#160;&amp;amp;#160; In my previous post -&amp;amp;#160; Best ASP.NET Performance Winner For Data Binding - Hands&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8802637</link><pubDate>Sat, 02 Aug 2008 01:21:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8802637</guid><dc:creator>Anatoly Lubarsky</dc:creator><description>&lt;p&gt;Well, I see a major flaw in this test since datagrid is not rendered into the pure html table actually.&lt;/p&gt;
&lt;p&gt;You'd better test this vs. repeater and even repeater supports a bunch of events like itemdatabound and itemcreated.&lt;/p&gt;</description></item><item><title>Links of the Week August 2 2008</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8803419</link><pubDate>Sat, 02 Aug 2008 04:10:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8803419</guid><dc:creator>Chris Love's Official Blog - Professional ASP.NET</dc:creator><description>&lt;p&gt;Another week of great resources for the .NET developer to take in. Amazing how many are out there. I&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8805346</link><pubDate>Sat, 02 Aug 2008 12:50:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8805346</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Anatoly,&lt;/p&gt;
&lt;p&gt;Thanks for the resourceful remark!&lt;/p&gt;
&lt;p&gt;My intention was to take customer's code and test it as is. There is simple meta pattern - developers code, end users use, IT guys support. All iwanted is to model what would it feel like for end users and IT guys when developers code the way they code (and as I just witnessed it)&lt;/p&gt;
&lt;p&gt;Repeater is another test I should have consider though - thanks for calling it out!&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831252</link><pubDate>Mon, 04 Aug 2008 18:22:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831252</guid><dc:creator>Joakim Westin</dc:creator><description>&lt;p&gt;Thanks for an interesting post!&lt;/p&gt;
&lt;p&gt;One question; did you exclude using StringBuilder on purpose? &lt;/p&gt;
&lt;p&gt;If not, it may be worth testing the &amp;quot;Response.Write&amp;quot; against using a StringBuffer to see how tha compares...&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Joakim&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831275</link><pubDate>Mon, 04 Aug 2008 18:32:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831275</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Joakim,&lt;/p&gt;
&lt;p&gt;Thanks for the insight!&lt;/p&gt;
&lt;p&gt;Few folks called this out too. I did not use StringBuilder originally as I was lazy to do so. In any way it would only improve it, right. But then I've built the demo that uses StringBuidler and there were no significant improvements. &lt;/p&gt;
&lt;p&gt;Next post is about using Repeater and ItemDataBoubd event as another reader called out Nice results BTW :)&lt;/p&gt;
&lt;p&gt;thanks for checking in.&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831295</link><pubDate>Mon, 04 Aug 2008 18:40:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831295</guid><dc:creator>Sam</dc:creator><description>&lt;p&gt;Hi, I think you could make the Response.Write even faster if you avoided the string concat inside of them. &lt;/p&gt;
&lt;p&gt;Response.Write(&amp;quot;&amp;lt;td&amp;gt;&amp;quot; + &amp;nbsp;item.Address &amp;nbsp;+ &amp;quot;&amp;lt;td&amp;gt;&amp;quot;);&lt;/p&gt;
&lt;p&gt;might be better written as&lt;/p&gt;
&lt;p&gt;Response.Write(&amp;quot;&amp;lt;td&amp;gt;&amp;quot;);&lt;/p&gt;
&lt;p&gt;Response.Write(item.Address);&lt;/p&gt;
&lt;p&gt;Response.Write(&amp;quot;&amp;lt;/td&amp;gt;&amp;quot;);&lt;/p&gt;
&lt;p&gt;I think that might reduce string concat.&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831300</link><pubDate>Mon, 04 Aug 2008 18:41:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831300</guid><dc:creator>Sam</dc:creator><description>&lt;p&gt;Also I think Response.Write just uses a stream which will perform as well or better than StringBuilder. Or at least it should :)&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831321</link><pubDate>Mon, 04 Aug 2008 18:49:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831321</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Sam, &lt;/p&gt;
&lt;p&gt;Thanks for the insight&lt;/p&gt;
&lt;p&gt;few pointed this one out too, see my prev response[.Write ] :)&lt;/p&gt;
&lt;p&gt;Just looked at your web site - oh, lala! Bookmarked&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831679</link><pubDate>Mon, 04 Aug 2008 20:49:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831679</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Note that Databinding is doing some additional stuff like cross-site-scripting checks, etc. that ideally you'll need to do if you use this method. &lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831704</link><pubDate>Mon, 04 Aug 2008 20:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831704</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Daniel!!&lt;/p&gt;
&lt;p&gt;That is perfect remark. Not perf wise but security wise.&lt;/p&gt;
&lt;p&gt;Brilliant!&lt;/p&gt;
&lt;p&gt;I do not think that applying htmlencoding will add to much burden vs reflection Databinding does, but i must appreciate your comment.&lt;/p&gt;
&lt;p&gt;See, security and perf, has never been good friends&lt;/p&gt;
&lt;p&gt;Very good catch!&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831844</link><pubDate>Mon, 04 Aug 2008 21:47:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831844</guid><dc:creator>Paco</dc:creator><description>&lt;p&gt;This is not a comparison between datagrid with reponse.write.&lt;/p&gt;
&lt;p&gt;Have you profiled it to find out what the real performance bottle neck is? Did you try it with serveral different datatypes?&lt;/p&gt;
&lt;p&gt;What is the influence of looping through the datagrid and then casting to myCollection?&lt;/p&gt;
&lt;p&gt;You can make a better benchmark to isolate the code before the databind() call and before the foreach loop in the other version.&lt;/p&gt;
&lt;p&gt;I have tried this before and I'm sure you will get totally different results!&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831869</link><pubDate>Mon, 04 Aug 2008 21:59:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831869</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Paco, can you please guide me what should I do to test your scenario? I am not sure i get &amp;quot;looping through the datagrid&amp;quot;. When I have datagrid I just call DataBind(). When I do not have datagrid i loop through every record w/response.write(). What scenario you refere to? &lt;/p&gt;
&lt;p&gt;According to PAG, whne binding there is reflection going on which hits perf.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ms998549.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms998549.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;look at &amp;quot;Minimize Calls to DataBinder.Eval&amp;quot; in it&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831920</link><pubDate>Mon, 04 Aug 2008 22:18:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831920</guid><dc:creator>Paco</dc:creator><description>&lt;p&gt;I'm sorry, I meant looping through the dataset (not the grid as i wrote) when you call the databind method. I'm targeting the loop that will be inside of the DataGrid.DataBind() method.&lt;/p&gt;
&lt;p&gt;The performace difference between &lt;/p&gt;
&lt;p&gt;(MyCollection)SampleServices.GenerateCollection(200) and (MyCollection)SampleServices.GenerateXML(200); might be significant here. &lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831957</link><pubDate>Mon, 04 Aug 2008 22:32:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831957</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;Oh, so you say the perf hit has nothing to do with Data Binding but due to data generation itself - either collection or XML. Ok I factored out this one during my tests. I need to post it next as it seems to be interesting too.&lt;/p&gt;
&lt;p&gt;Thanks for the insight, Paco!&lt;/p&gt;
&lt;p&gt;Anyway i suggest you reading PAG's stuff at &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/ms998549.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms998549.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8831976</link><pubDate>Mon, 04 Aug 2008 22:39:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831976</guid><dc:creator>Paco</dc:creator><description>&lt;p&gt;I'm currently reading the article you suggested.&lt;/p&gt;
&lt;p&gt;But I mean this:&lt;/p&gt;
&lt;p&gt;datagrid.DataSource = myDatatable;&lt;/p&gt;
&lt;p&gt;Stopwatch watch = new Stopwatch();&lt;/p&gt;
&lt;p&gt;watch.Start();&lt;/p&gt;
&lt;p&gt;datagrid.DataBind();&lt;/p&gt;
&lt;p&gt;watch.Stop();&lt;/p&gt;
&lt;p&gt;Response.Write(watch.ElapsedTicks);&lt;/p&gt;
&lt;p&gt;watch.Start();&lt;/p&gt;
&lt;p&gt;foreach (MyClass item in myDatatable.Rows)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Response.Write(item.MyProperty);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;watch.Stop();&lt;/p&gt;
&lt;p&gt;Response.Write(watch.ElapsedTicks);&lt;/p&gt;
&lt;p&gt;The second ElapsedTicks is always smaller. &lt;/p&gt;
&lt;p&gt;datagrid.DataSource = myDatatable;&lt;/p&gt;
&lt;p&gt;Stopwatch watch = new Stopwatch();&lt;/p&gt;
&lt;p&gt;watch.Start();&lt;/p&gt;
&lt;p&gt;datagrid.DataBind();&lt;/p&gt;
&lt;p&gt;watch.Stop();&lt;/p&gt;
&lt;p&gt;Response.Write(watch.ElapsedTicks);&lt;/p&gt;
&lt;p&gt;watch.Start();&lt;/p&gt;
&lt;p&gt;foreach (MyClass item in myDatatable.Rows)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Response.Write(item.MyProperty);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;watch.Stop();&lt;/p&gt;
&lt;p&gt;Response.Write(watch.ElapsedTicks);&lt;/p&gt;
&lt;p&gt;The second time is always faster at my computer.&lt;/p&gt;
&lt;p&gt;I don't have 2003/1.1 installed anymore. I tested this with 2008/3.5&lt;/p&gt;
&lt;p&gt;It's a long time ago I used DataTable/Set/Grid/List, etc.&lt;/p&gt;
&lt;p&gt;I like castle and Asp.Net MVC and when I have to use classic Asp.Net, I always use repeaters.&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8832127</link><pubDate>Tue, 05 Aug 2008 00:01:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8832127</guid><dc:creator>GrillerGeek</dc:creator><description>&lt;p&gt;We have noticed the same perf hits with databinding. We ended up using repeaters the first time then calling Repeater.RenderControl() and sticking the output into cache. The next time the page is hit we check for the output in cache and just return the string to a literal instead of databinding the repeater again. It has proven to be very fast.&lt;/p&gt;</description></item><item><title>re: Best ASP.NET Performance Winner For Data Binding - Hands Up To Response.Write()</title><link>http://blogs.msdn.com/alikl/archive/2008/07/31/best-asp-net-performance-winner-for-data-binding-hands-up-to-response-write.aspx#8833563</link><pubDate>Tue, 05 Aug 2008 12:40:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8833563</guid><dc:creator>alikl</dc:creator><description>&lt;p&gt;GrillerGeek!&lt;/p&gt;
&lt;p&gt;Thanks fir the insight. I've done quick and dirty test w/Repeater and it performs close to simple Response.Write which makes Repeater a winner i guess.&lt;/p&gt;
</description></item></channel></rss>