I would like to know what the best way (performance wise) to access a large data structure is. There are about hundred ways to do it but what is the most accessible for the compiler to optimize?
One can access a value by
foo[someindex].bar[indexlist[i].subelement[j]].baz[0]
or create some pointer aliases like
sometype_t* tmpfoo = &foo[someindex];
tmpfoo->bar[indexlist[i].subelement[j]].baz[0]
or create reference aliases like
sometype_t &tmpfoo = foo[someindex];
tmpfoo.bar[indexlist[i].subelement[j]].baz[0]
and so forth...