They would be the same, with one modification.
You would go
uint[1000000] index;
// index.length = 1000000; not needed
The dynamic index you used is only slightly more expensive than the fixed-length array suggested because it needs another 32-byte word for the array length and the extra step of setting it.
Both methods use a 32-byte key to point to a 32-byte word. Both methods will avoid writing unnecessarily and values default to 0 in indexes that haven't been written to.
Neither method benefits from reducing the precision of the values pointed to (to, say, uint8
) because a 32-byte word is the smallest space they can address.
Hope it helps.