In D, it appears that dynamic arrays (at least by default) use a ulong as their key type. They are declared like this:
string[] dynamicArray;
I imagine that using a 64-bit value as the key would be slower than using 32 bits or 16 bits, and 64 bits is way overkill for nearly everything. However, if I declare the array as string[uint] myArray;
or string[ushort] myArray
, it's treated as an associative array. This means that I don't get to do the things I want to do with a dynamic array, such as appending.
So I have some questions:
Is there a way to declare a dynamic array with a uint, ushort, or ubyte key?
If there was, would it really be faster?
Is an associative array with a ushort key faster than a dynamic array with a ulong key?