1 2007-10-10 Juraj Skripsky <js@hotfeet.ch>
3 * Dictionary.cs (Enumerator.MoveNext): Handle the case where we
4 had already reached the end. Fixes bug #332534.
6 2007-08-20 Jb Evain <jbevain@novell.com>
8 * List.cs (AddCollection): return early if the collection
11 2007-08-08 Atsushi Enomoto <atsushi@ximian.com>
13 * Dictionary.cs : [Comvisible(true)]->[ComVisible(false)].
15 2007-06-23 Marek Safar <marek.safar@gmail.com>
17 * List.cs: Make CheckMatch static.
19 2007-06-20 Juraj Skripsky <js@hotfeet.ch>
21 * Dictionary.cs: Optimize and add implementation notes. Use a "mini-heap"
22 to store the linked lists instead of the regular heap. Split arrays of
23 structs into separate arrays to make the GC's life simpler (see bug 81879
24 for details). Make class serialization compatible with MS.NET.
26 * EqualityComparer.cs: Rename IEquatableOfTEqualityComparer<T> to
27 GenericEqualityComparer<T> to fix binary serialization compatibility
30 2006-04-16 Jonathan Chambers <joncham@gmail.com>
32 * List.cs: Clear entry in RemoveAt after removing item.
35 2007-03-27 Alan McGovern <alan.mcgovern@gmail.com>
37 * List.cs: Optimized several methods to increase performance
39 2007-03-21 Juraj Skripsky <js@hotfeet.ch>
41 * List.cs (FindAllStackBits): Small optimization to the new code.
42 Built resulting List<T> directly as an array, wrap it in a List<T>
43 afterwards. Stop the filling of the result array as soon as all
44 matching items have been processed.
46 2007-03-20 Juan Cristóbal Olivares <juancri@gmail.com>
48 * List.cs (FindAll): Optimize FindAll using a bitmask to determine
49 the number of positive matches, this increases the performance in
50 all cases below 10,000,000 elements extensively:
53 old method: 00:00:00.0126610 (26x)
54 stackalloc bit method: 00:00:00.0004750 (1x)
55 array bit method: 00:00:00.0010700 (2x)
56 heap bit method: 00:00:00.0038830 (8x)
59 old method: 00:00:00.0139250 (24x)
60 stackalloc bit method: 00:00:00.0005670 (1x)
61 array bit method: 00:00:00.0010890 (2x)
62 heap bit method: 00:00:00.0034920 (6x)
65 old method: 00:00:00.0136110 (12x)
66 stackalloc bit method: 00:00:00.0011240 (1x)
67 array bit method: 00:00:00.0016450 (1.4x)
68 heap bit method: 00:00:00.0043110 (3x)
71 old method: 00:00:00.0175970 (3x)
72 stackalloc bit method: 00:00:00.0085630 (1.5x)
73 array bit method: 00:00:00.0055010 (1x)
74 heap bit method: 00:00:00.0099590 (1.8x)
77 old method: 00:00:00.0210330 (2x)
78 array bit method: 00:00:00.0100430 (1x)
79 heap bit method: 00:00:00.0154150 (1.5x)
82 old method: 00:00:00.1243730 (1.2x)
83 array bit method: 00:00:00.0973110 (1x)
84 heap bit method: 00:00:00.1285650 (1.3x)
87 old method: 00:00:00.9252570 (1x)
88 array bit method: 00:00:00.9632300 ( 1.05x)
89 heap bit method: 00:00:01.1098490 (1.20x)
91 2007-03-08 David Mitchell <dmitchell@logos.com>
93 * List.cs: Fix the case where List.set_Item(int index) throws
94 inappropriate exception when index is equal to List.Count
96 List.IndexOf(object item) and IList.Contains(object item) throw
97 exceptions when given invalid types.
99 IList.Add(object item) throws InvalidCastException when item is
100 not of the correct type.
102 2007-03-08 Gert Driesen <drieseng@users.sourceforge.net>
104 * Comparer.cs: Renamed IComparableOfTComparer<T> to GenericComparer<T>
105 to fix binary serialization compatibility with MS.
107 2007-03-05 David Mitchell <dmitchell@logos.com>
109 * Dictionary.cs: An instance of Dictionary<TKey,TValue> is
110 supposed to throw a KeyNotFoundException when
111 the user attempts to retrieve the value associated with a key that
112 is not in the dictionary.
114 On the other hand, an instance of IDictionary is supposed to
115 return null in similar circumstances.
117 2007-03-05 David Mitchell <dmitchell@logos.com>
119 * List.cs: Fix InsertRange bug (80930).
121 2006-09-15 Gert Driesen <drieseng@users.sourceforge.net>
123 * List.cs: Fixed binary serialization compatibility with MS.NET.
124 Increment version whenever _items is modified; this fixes version
125 checks in Enumerator.
127 2006-09-06 Zoltan Varga <vargaz@gmail.com>
129 * Dictionary.cs: Speed up get_Item/set_Item/GetPrev () a bit. Increase capacity
130 specified by the user so 'capacity' elements can really be added without resizing.
132 2006-07-12 Zoltan Varga <vargaz@gmail.com>
134 * Dictionary.cs: Swap order of parameters to cmp.Equals () to improve
135 compatibility with MS.NET and strange Equals () implementations.
137 2006-05-17 Kazuki Oikawa <kazuki@panicode.com>
139 * List.cs : implemented Sort(Comparison <T>).
141 2006-05-08 Atsushi Enomoto <atsushi@ximian.com>
143 * List.cs : use proper comparer in Contains(), IndexOf() and
144 LastIndexOf(). Patch by Kazuki Oikawa. Fixed bug #77277.
146 2006-03-16 Ankit Jain <jankit@novell.com>
148 * List.cs (CheckIndex): Check for -ve indices and allow index == size.
149 (Insert): Use CheckIndex.
151 2006-03-12 Zoltan Varga <vargaz@gmail.com>
153 * List.cs: Applied patch from <kazuki@panicode.com>. Fixes #77504.
155 2006-02-10 Martin Baulig <martin@ximian.com>
158 (IComparableOfTComparer): `T' must implement `IComparable<T>' and
161 Tue Jan 24 18:22:54 CET 2006 Paolo Molaro <lupus@ximian.com>
163 * Dictionary.cs: avoid long reminder operations.
165 2006-01-23 Raja R Harinath <rharinath@novell.com>
167 Speed up remove. Use 'dict[k]=v' as a self-tuning hint.
168 * Dictionary.cs (GetSlot): Move data-structure traversal to ...
169 (GetPrev): ... this. Returns the slot prior to the place we're
170 looking for, or null if that place is the head of the chain.
172 (this.set): Use it. Implement move-to-front on set.
174 * Dictionary.cs (ToTKey, ToTValue): New helpers to convert from
176 (IDictionary.this, IDictionary.Add): Use them.
177 (IDictionary.Contains, IDictionary.Remove): If the types don't
180 2006-01-19 Raja R Harinath <rharinath@novell.com>
182 Fix to pass new nunit tests.
183 * Dictionary.cs (ShimEnumerator): New class. Implement the
184 requirement that ((IDictionary) foo).GetEnumerator ().Current has
185 type DictionaryEntry.
186 (IDictionary.GetEnumerator): Use ShimEnumerator.
187 (Enumerator.Current): Now has type KeyValuePair<TKey, TValue>.
188 (Enumerator.MoveNext): Use VerifyState.
189 (Enumerator.VerifyState): Move validation of 'current' field to ...
190 (Enumerator.CurrentSlot): ... this.
191 (Enumerator.Current, Enumerator.IDictionaryEnumerator.Entry):
193 (CopyTo, ICollection.CopyTo): Use subtle reasoning to replace a
194 '>=' with a '>'. Don't throw an ArgumentException when
195 index==array.Length && Count==0.
196 (KeyCollection.CopyTo, ValueCollection.CopyTo): Likewise, and thus
197 obviate the need to check (dictionary.Count == 0).
199 2005-12-20 Sebastien Pouliot <sebastien@ximian.com>
201 * List.cs: Applied Atsushi's patch for Sort (bug 76361) now that the
202 generic versions of Array.Sort are implemented.
204 2005-12-19 Sebastien Pouliot <sebastien@ximian.com>
206 * Dictionary.cs: Added [Serializable] attribute to both inner
207 Enumerator struct in Key and Value inner collection classes.
208 * EqualityComparer.cs: Added missing IEqualityComparer interface.
209 * List.cs: Added [Serializable] attribute to both inner Enumerator
212 2005-12-19 Sebastien Pouliot <sebastien@ximian.com>
214 * Dictionary.cs: Fixed ICollection.CopyTo to use DictionaryEntry. Fixed
215 Key and Value CopyTo not to throw exception if the dictionary is empty
217 * List.cs: Fix exception reporting to match MS behaviour (2.0 final).
219 2005-11-19 Zoltan Varga <vargaz@gmail.com>
221 * KeyNotFoundException.cs: Add default message.
223 2005-09-18 Miguel de Icaza <miguel@novell.com>
225 * Dictionary.cs: Change style for internal fields.
227 If the capacity is zero, set the capacity to our default size as 0
228 is an allowed parameter in .NET
230 2005-08-10 Kamil Skalski <nazgul@nemerle.org>
232 * KeyValuePair.cs, Dictionary.cs: Change Key and Value to properties to match
233 .NET 2.0 July CTP. Update its use in Dictionary, since now we
234 cannot write to them.
236 2005-07-10 Kamil Skalski <nazgul@nemerle.org>
238 * Comparer.cs, EqualityComparer.cs: Use MakeGenericType instead of BindGenericParameters.
241 2005-06-27 Raja R Harinath <rharinath@novell.com>
243 Introduce some thread-safety by removing the modify-on-read
244 move-to-front heuristic.
245 * Dictionary.cs (_enumeratorGeneration, _enumerators): Remove.
246 (Count): Add internal property set. Invalidate enumerators when
247 Count is changed. Change all references of _usedSlots to Count.
248 (this): Invalidate enumerators when the value of some slot is
249 changed, even if the layout of the data-structure isn't modified.
250 (DoHash): Remove null-key check. All codepaths leading to this
251 function already have the check.
252 (GetSlot): Remove move-to-front heuristic.
255 2005-06-24 Martin Baulig <martin@ximian.com>
257 * IDictionary.cs: Use the same type parameter names than on MS.
259 * IDictionary.cs, Dictionary.cs: We don't need the `CLSCompliant'
262 2005-06-23 Martin Baulig <martin@ximian.com>
264 * *.cs: Removed the `[ComVisible(false)]' attributes everywhere.
266 2005-06-22 Raja R Harinath <rharinath@novell.com>
268 * Dictionary.cs (_generation, _enumeratorGeneration, _enumerators):
269 New fields to implement fail-fast semantics. All code that
270 modifies the table increment _generation.
271 (GetSlot): Use _hcp to compare keys. Return the slot containing
272 the key, rather than the index. Avoid move-to-front heuristic
273 when there's an enumerator coursing through the table.
274 (this, Add, TryGetValue, ContainsKey, Remove): Update to change.
275 (Enumerator.Enumerator): Save the generation of the dictionary.
276 (Enumerator.Dispose): Inform dictionary that the enumerator is no more.
277 (Enumerator.MoveNext, Enumerator.VerifyState): Fail if the
278 dictionary has been modified.
280 2005-06-20 David waite <mass@akuma.org>
282 * List.cs : substantial changes and optimizations
283 (AddCollection, AddEnumerable): new internal specializations of AddRange
284 (AsReadOnly): returns specific IList<T> to match ms.net 2.0b2 api.
285 (Clear): reset size to zero on clear
286 (ConvertAll): catch null converter, use Add to prevent OutOfBounds
288 (FindAll, FindIndex, FindLast, FindLastIndex, RemoveAll, TrueForAll):
290 (FindLastIndex): correct index parameters based on ms.net 2005b2 behavior
291 (ForEach): catch null action
292 (CheckIndex): new internal function similar to CheckRange for functions
293 which only provide a starting index
294 (InsertCollection, InsertEnumerable): new internal specializations of
296 (ReadOnlyList): removed, ReadOnlyCollection in
297 System.Collections.ObjectModel is used instead now
299 2005-06-16 David Waite <mass@akuma.org>
301 * Dictionary.cs (EnumerationMode): Remove.
302 (Enumerator): Remove return type flag - legacy return is expected to
303 always return a DictionaryEntry
304 (Enumerator): Make constructor internal, it is not public on ms.net
306 (VerifyState): Added method to check state preconditions and throw
307 appropriate exceptions.
308 (KeyCollection,ValueCollection): Mark sealed to match ms.net beta 2
309 (KeyCollection.Enumerator._hostEnumerator): make exact struct type,
310 rather than boxing and using by interface
311 (KeyCollection.Enumerator.Dispose): Call _hostEnumerator.Dispose.
312 (ValueCollection.Enumerator._hostEnumerator): make exact struct type,
313 rather than boxing and using by interface
314 (ValueCollection.Enumerator.Dispose): Call _hostEnumerator.Dispose.
315 * EqualityComparer.cs (DefaultComparer, IEquatableOfTEqualityComparer):
316 Mark as serializable.
318 2005-06-16 Raja R Harinath <rharinath@novell.com>
320 * Dictionary.cs (GetKeys, GetValues): Remove.
321 (SetThreshold): New function to calculate the resize threshold.
322 (CopyTo): Don't use foreach syntax.
323 (ContainsValue): Likewise. Use default equality comparer of the
325 (GetObjectData): Use CopyTo to copy into temporary array. Don't
326 save redundant _usedSlots and _threshold.
327 (OnDeserialization): Rewrite.
328 (ICollection<>.CopyTo): Forward to CopyTo.
329 (Enumerator._nextIndex): Rename to from _index.
330 (Enumerator._next, Enumerator.FixNext): Remove.
331 (Enumerator.Current): Rewrite to avoid need for _next.
332 (Enumerator.IEnumerator.Reset): Update.
333 (KeyCollection): Is also IEnumerable<TKey> and IEnumerable.
334 Update methods to conform to standard.
335 (KeyCollection.GetEnumerator): Restore. Return the correct type.
336 (KeyCollection.Enumerator): Rename from KeyEnumerator. Simple
337 wrapper that forwards to Dictionary<,>.Enumerator.
338 (ValueCollection): Likewise.
340 2005-06-12 David Waite <dwaite@gmail.com>
342 * IKeyComparer.cs: removed
343 * KeyValuePair.cs: add same-style ToString as ms.net Beta2 impl,
344 make Serializable, use correct field names.
345 * Dictionary.cs: Miscelaneus clean-ups, added serialization
346 support, use Hashtable prime functions
348 2005-06-12 Ben Maurer <bmaurer@ximian.com>
350 * Comparer.cs, EqualityComparer.cs: Important performance hack:
351 make sure that we don't box stuff and do reflection on every
352 comparison. We use reflection at cctor time rather than on every
355 2005-06-09 Raja R Harinath <rharinath@novell.com>
357 Simplify Enumerator.MoveNext to make it "obviously correct", rather
358 than require subtle reasoning about the state of various variables.
359 * Dictionary.cs (Enumerator._isValid): Remove. Replace all uses
360 with "_current == null".
361 (Enumerator._validNodeVisited): Remove.
362 (Enumerator._next): New. Holds the the next position.
363 (Enumerator.FixNest): New helper function that ensures that _next
365 (Enumerator.MoveNext): Simplify. Now, copies _next to _current
366 and advances _next if possible.
368 2005-06-08 Martin Baulig <martin@ximian.com>
370 * Dictionary.cs (Dictionary.KeyEnumerator): Removed the public
371 GetEnumerator() function since it's returning the wrong type.
372 (Dictionary.ValueEnumerator): Likewise. Fix #75073.
374 2005-06-08 Ankit Jain <ankit@corewars.org>
376 * Dictionary.cs (Dictionary<TKey, TValue>.MoveNext): Allow traversal of chain in last slot
377 of the table. Fixes #75168.
379 2005-06-04 Ben Maurer <bmaurer@ximian.com>
381 * *.cs: 2.0 api fixups
383 2005-05-26 Miguel de Icaza <miguel@novell.com>
385 * Dictionary.cs: Remove the `Hash' name from the Dictionary
386 internal classes, make them public.
388 2005-05-26 Zoltan Varga <vargaz@freemail.hu>
390 * Dictionary.cs: Fix a warning.
392 * IDictionary.cs: Add missing TryGetValue method.
394 2005-05-19 Geoff Norton <gnorton@customerdna.com>
396 * List.cs (Insert): Resize the array before the shift if needed
398 2005-05-18 Miguel de Icaza <miguel@novell.com>
400 * List.cs (GetRange): Implement.
402 Do not do lazy loading of data. Not worth adding an
403 extra check, and not worth the bugs.
405 This decision wont be discussed until: a) a full List regression
406 test suite exists and b) performance benchmarks are created. (b)
407 depends on (a) or the argument wont even be heard.
409 2005-05-13 Atsushi Enomoto <atsushi@ximian.com>
411 * Queue.cs, Stack.cs: moved to System.dll
413 2005-05-06 Martin Baulig <martin@ximian.com>
415 * *.cs: Add CLSCompliant(true) where missing.
417 2005-05-06 Zoltan Varga <vargaz@freemail.hu>
419 * *.cs: Remove CLSCompliant(false) attributes.
421 2005-05-05 Zoltan Varga <vargaz@freemail.hu>
423 * List.cs: Applied patch from Mart Roosmaa (roosmaa@gmail.com).
424 Fix Insert method. Fixes #74824.
426 2005-04-29 Martin Baulig <martin@ximian.com>
428 Reflect latest spec changes.
430 * IEnumerable.cs (IEnumerable<T>): Implement IEnumerable.
431 * IEnumerator.cs (IEnumerator<T>): Implement IEnumerator.
433 2005-04-29 Raja R Harinath <rharinath@novell.com>
436 * Dictionary.cs (Slot<K,V>): Move to ...
437 (Dictionary<K,V>.Slot): ... here.
439 2005-04-28 Martin Baulig <martin@ximian.com>
441 * Dictionary.cs, Queue.cs, Stack.cs, List.cs, Comparer.cs: Don't
442 duplicate type parameters in the nested classes.
444 2005-04-20 Zoltan Varga <vargaz@freemail.hu>
446 * List.cs: Fix ToArray () method. Fixes #74675.
448 2005-04-04 Raja R Harinath <rharinath@novell.com>
450 * Dictionary.cs: Update to draft of Feb 27. Add some argument checks.
451 (GetSlot): Don't throw KeyNotFoundException. Unify all list
452 traversals in here. Move found key to head of chain, and return
453 the index of the chain suitable for/containing the key.
454 (Item, Add, Remove): Simplify, and remove FIXMEs.
455 (Resize): Reuse linked list nodes from old table.
456 (Dictionary.CopyTo, HashKeyCollection.CopyTo, HashValueCollection.CopyTo):
457 Add some argument checks.
459 2005-04-02 Ben Maurer <bmaurer@ximian.com>
461 * Dictionary.cs: Real impl.
463 2005-02-21 Martin Baulig <martin@ximian.com>
465 * IComparer.cs: Reverted the last change here, Equals() and
466 GetHashCode() have been removed a long time ago.
468 2005-02-21 Kazuki Oikawa <kazuki@panicode.com>
470 * IComparer.cs, IDictionary.cs: Corrected the wrong declaration.
472 2005-02-11 Carlos Alberto Cortez <calberto.cortez@gmail.com>
474 * List.cs: Added internal ReadOnlyCollection class,
475 which is a wrapper for a read only IList<T> version of the List<T>.
476 Used in AsReadOnly () method.
478 2005-02-07 Ben Maurer <bmaurer@ximian.com>
480 * List.cs (CheckRange): Comparison error. Duh!
481 (Shift): really deal with neg. delta. Also, adjust the `size'.
483 Based on a patch from Marc Denty (marc.denty@libertysurf.fr).
487 2005-01-29 Ben Maurer <bmaurer@ximian.com>
489 * Queue.cs: `duh' bugs.
491 2004-12-27 Ben Maurer <bmaurer@ximian.com>
493 * Stack.cs: Stupid bug fixes.
495 * List.cs: My new (mostly untested ;-) impl of List
496 <T>. Implements most of the API.
498 2004-12-26 Ben Maurer <bmaurer@ximian.com>
500 * Queue.cs: New, non-linked-list based impl.
502 2004-11-29 Ben Maurer <bmaurer@ximian.com>
504 * Comparer.cs: Update this class.
506 2004-11-25 Carlos Alberto Cortez <calberto.cortez@gmail.com>
508 * List.cs: Enumerator changed to behave like the MS impl.
510 2004-11-25 Ben Maurer <bmaurer@ximian.com>
512 * Stack.cs: New, list based impl. Waiting for some gmcs fixes.
514 2004-11-10 Martin Baulig <martin@ximian.com>
516 * IDictionary.cs (IDictionary): `IsReadOnly' and `Clear' are
517 inherited from ICollection.
519 2004-09-20 Gert Driesen <drieseng@users.sourceforge.net>
521 * ReadOnlyCollection.cs: Moved to System assembly
522 * Collection.cs: Moved to System assembly
524 2004-09-07 Carlos Alberto Cortez <carlos@unixmexico.org>
526 * ReadOnlyCollection.cs: New file and changes to
527 Collection.cs tu support it.
529 2004-09-05 Marek Safar <marek.safar@seznam.cz>
531 * Dictionary.cs: Added new file (no implementation).
533 2004-09-03 Carlos Alberto Cortez <carlos@unixmexico.org>
535 * Collection.cs: Small improvements related to
536 style, resizing, and type checking.
538 2004-09-01 Carlos Alberto Cortez <carlos@unixmexico.org>
540 * Collection.cs: New file.
542 2004-08-04 Martin Baulig <martin@ximian.com>
544 * List.cs (List<T>.Enumerator): Made this a struct.
545 (List<T>.GetEnumerator): The public method now returns the
548 2004-08-02 Martin Baulig <martin@ximian.com>
550 Started to do some API review.
552 * ICollection.cs (ICollection<T>): Added IsReadOnly, Add, Clear,
555 * IList.cs (IList<T>): Removed Add, Clear, Constains, Remove,
556 IsReadOnly and IsFixedSize.
558 2004-08-02 Martin Baulig <martin@ximian.com>
560 * IList.cs (IList.Add): Changed return type to void.
562 * List.cs (List.Add): Likewise.
564 2004-07-16 Martin Baulig <martin@ximian.com>
566 * IComparable.cs: Removed, it's in System.
568 2004-07-12 Duncan Mak <duncan@ximian.com>
570 * KeyNotFoundException.cs: Added.
572 2004-06-18 Ben Maurer <bmaurer@ximian.com>
574 * Comparer.cs: v2 impl. Some workarounds for gmcs are enabled.
576 2004-05-26 Sebastien Pouliot <sebastien@ximian.com>
578 * Queue.cs: Fixed possible integer overflow in CopyTo methods.
579 * Stack.cs: Fixed possible integer overflow in CopyTo methods.
581 2004-03-13 Martin Baulig <martin@ximian.com>
583 * Stack.cs, Queue.cs, List.cs: Implement the non-generic interfaces.
585 2004-03-11 Martin Baulig <martin@ximian.com>
589 2004-03-11 Martin Baulig <martin@ximian.com>
591 * Stack.cs, Queue.cs: Just use `Node' for the nested class, not
592 `Node<T>' (which would create another type parameter `T'
593 overriding `T' from the outer class).
595 2004-02-23 Martin Baulig <martin@ximian.com>
597 * Stack.cs, Queue.cs: New files. Hmm, looks like I forgot to add
598 them to CVS; they're already on my hard disk since December or so.
600 2003-12-08 Martin Baulig <martin@ximian.com>
602 * *.cs: require GENERICS.
604 2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
606 * *.cs: require NET_2_0 and GENERICS
608 2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
610 * IComparable.cs, IComparer.cs, IDictionary.cs, IKeyComparer.cs, KeyValuePair.cs
613 2003-11-06 Martin Baulig <martin@ximian.com>
615 * ICollection.cs, IList.cs, IEnumerator.cs, IEnumerable.cs:
616 Started to implement the System.Collections.Generic classes.