This project is read-only.


Jan 13, 2008 at 6:36 AM
Are there any reasons why TigerMUD uses ArrayList's and Hashtables as opposed to List<> and Dictionary<,> it appears that the generic collections are considerably faster in some cases and also don't need to be type casted as they are all explicitly typed.

For example, i was able to convert the actor's states indexer to a dictionary with almost no other code modifications:

// indexer
public Dictionary<string, object> states = new Dictionary<string, object>();

This isn't a perfect example obviously because it still uses an object as the value but keys are guaranteed to be string values.

Another example is in the TigerMUD.Lib class:

public static List<Actor> actors = new List<Actor>(); // List of existing items

Provides type safety and is much faster for enumerations;
Jan 13, 2008 at 12:33 PM
I'd say it's probably because List and Dictionary didn't exist in .NET 1.0, which we originally started on. If you want to run some profiling and prove they are actually faster, and not just 'probably faster', have a blast changing them.
Jan 14, 2008 at 4:43 AM

Generic lists are indeed faster and can use alot less memory too. Here's a good analysis:
Not having to do the type cast manually would also clean up the code alot.

The reason we don't use them is what William stated. We started on .NET 1.1 so generics were not available at the time and no one had made the updates yet. Spare time programming being what it is. :-)

If you're interested in making checkins to share with everyone, that would be a very nice contribution. Please let me know if so and I will give you dev permissions to do that.