<?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>Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx</link><description>As usual there isn’t really one set of rules that will always guide you to making the right decisions but I’d like to offer some approximately correct guidance to help you to decide when you should decline the standard menu and instead cook up your own</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>RE: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#374333</link><pubDate>Wed, 16 Feb 2005 13:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374333</guid><dc:creator>Joannes</dc:creator><description>Btw, is the SortedList implementation going to be fixed in .Net 2.0? In .Net 1.1, the implementation is such that all insertion/deletion operations cost O(n) instead of O(ln(n)) as anyone would expect for such a collection.</description></item><item><title>re: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#374549</link><pubDate>Wed, 16 Feb 2005 18:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374549</guid><dc:creator>Rico Mariani</dc:creator><description>The thing about collections is they come in a lot of flavors.  This particular flavor of SortedList offers this nice function:&lt;br&gt;&lt;br&gt;public virtual Object GetByIndex(int index){}&lt;br&gt;&lt;br&gt;But in order to offer that service (at constant time) you have to pay a price at insert time.  &lt;br&gt;&lt;br&gt;Of course there are other implementations of a sorted list that offer faster insertions but have no random access.&lt;br&gt;</description></item><item><title>re: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#374562</link><pubDate>Wed, 16 Feb 2005 18:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374562</guid><dc:creator>Steven Padfield</dc:creator><description>Thanks for the nice article, Rico.  I really enjoy having resources to help make decisions, not necessarily just on what code to type.</description></item><item><title>re: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#374661</link><pubDate>Wed, 16 Feb 2005 19:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:374661</guid><dc:creator>Rico Mariani</dc:creator><description>It's funny that you should choose those words.  I've been trying to explain what it is that an architect at Microsoft does and what I've taken to telling people is: &amp;quot;I'm in the decision improvement business&amp;quot;&lt;br&gt;&lt;br&gt;Maybe I'm on to something :)&lt;br&gt;&lt;br&gt;Thanks for the kind words</description></item><item><title>re: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#377278</link><pubDate>Mon, 21 Feb 2005 12:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:377278</guid><dc:creator>Yogesh Chhabra</dc:creator><description>How about Rule #7? Do if it improves the readability/usability of you API's.&lt;br&gt;We have an application where one of the input parameters is a Hashtable of Hashtables. So the inner Hashtable would be a collection like&lt;br&gt;Price[&amp;quot;Widget&amp;quot;] = 1.01m&lt;br&gt;Price[&amp;quot;ThingyBob&amp;quot;]=2.02m&lt;br&gt; and there would be a bossman collection that held these:&lt;br&gt;Store[&amp;quot;Wallmart&amp;quot;] = Price1&lt;br&gt;Store[&amp;quot;Tiffany&amp;quot;] = Price2&lt;br&gt;&lt;br&gt;Now if we had a method like LoadData(System.Collections.IDictionary values) I would have little of no clue as to what this method actually took. What are the keys and what are the values?&lt;br&gt;If I defined a custom collection IDictionaryStringKeyDecimalValue and IDictionaryStringKeyIDictionaryStringKeyDecimalValueValue ( i.e. a fake IDictionary&amp;lt;String, IDictionary&amp;lt;String, Decimal&amp;gt; &amp;gt; ), at the risk of aggravating my RSI, I've given API consumers ( and myself! ) a pretty clear indication of what my method is expecting. They still probably need to read the docs to get a compete picture ( i.e. what are the valid string values? What exceptions does this thing throw etc) but they are in the right frame of mind before they hit F1. With code generators like CodeSmith, actually creating these things is not that painful anymore.&lt;br&gt;</description></item><item><title>re: Collections too slow? When to write your own basic types</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#378779</link><pubDate>Wed, 23 Feb 2005 12:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:378779</guid><dc:creator>Ivan Stoev</dc:creator><description>We definitely prefer #1, but unfortunately forced to do #2. Which wasn't true with STL for instance. With the presense of generics, what was the problem BCL to expose a low level, highly customizable (via generic type parameters (traits)) collection types (preferable structs) and build current &amp;quot;full service&amp;quot; classes on top of them?&lt;br&gt;And if they are supposed to be used only for implementation (i.e. containment and delegation), why they are implemented as classes at all (instead of structs)?&lt;br&gt;The point is that in order to be able to follow Rule#1, we need much better BCL, in particular Collections.Generic - the current just brings me back to old VB6 days when we had a &amp;quot;great&amp;quot; choice between array, Collection and Dictionary - doesn't seem a big step forward?</description></item><item><title>Optimizacao de codigo Win32 e Managed</title><link>http://blogs.msdn.com/ricom/archive/2005/02/16/374167.aspx#417161</link><pubDate>Fri, 13 May 2005 14:05:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:417161</guid><dc:creator>Programando .NET</dc:creator><description /></item></channel></rss>