I'd like to know which method is faster when it comes to reading 2D arrays with variable lengths (jagged, not matrices):
An Array filled with objects with key-values
An Array filled with Arrays
reading an a**rray filled with arrays** is done with:
array[position][subposition]
whereas reading an array filled with objects is done with:
array[position].value
in code, the latter is way more convenient as you can assign names, but the former uses only numeral accessors, making it use less code. Which one uses less processing power? and why?
last sub-question: is there an even faster way of 2D (variable length) arrays? and how to do this?
Array addressing will always be faster than dictionaries (your "key-values"), but they're not equivalent, so either I'm not understanding the question or you're mixing apples and orangutans.
You would use an array of array when what you're storing on each array[x][y] are all objects of the same type. If what you're intending to do is replace an array of objects with an array of property-containing arrays, where say:
array[0][0] is the name
array[0][1] is the position
array[0][2] is the size
etc.
then I would strongly advise against it. The small performance difference you'll obtain versus creating an array of objects will not be worth losing the advantages of compiler checks, and in the end you're likely to end up writing more code just for sanity check.
As a general suggestion, do not try to perform tricky optimizations until you've measured if they will be worth it.
Arrays filled with objects is probably faster since there would be no need to do bounds checking on a subarray. Then again, the JIT compiler would probably be clever enough to realise that your subarray indices would never cause out-of-bounds errors.
In any case, as Ricardo says, use whatever makes more sense in the context of your program. The difference -- if any -- will be negligible.