what You showed?
and i'm strongly afrayd becouse:
"Actually:
- Array have range checks for bounds. Really helpful to find bugs, and improve stability/safety of the app
..."
probably an overhead of these 'dynamics' arrays is tramedous!
pointers ale always fastest... therefore c is better.
Yes and no. Range checks are controlled by compiler settings. You enable them for testing, but not for releases.
Ref counts can add a bit of overhead if you have multiple variables sharing the same array (like several pointers to the same memory),
and you often change to which memory an array variable points. That isn't necessarily the case in all apps.
But as I said earlier
If you have the option of using an array (and that is an array with correct bounds) then that is preferable, because range checks can catch errors.
Or, if you don't have the option, then you can use a pointer with index. But you should know what your reason is, because by not using arrays you invite the risk of other potential issues, and you may loose hours, day or weeks to finding errors, that an array would have avoided. Of course the keyword is risk. It may not happen. But it can happen to anyone, up to the highest expert.
If your app is that time critical, then you need more details to determine if and how much an array actually affects you.
But also, if your app is that time critical your initial question of using pointer with index, may be to slow too.Are you accessing elements in random order, will that cause cache misses?
Or are you accessing then in sequence? But then an index is slow, and you should use "inc(ptr)" instead.
And, btw, in principal the index vs inc speed diff applies to all languages. Only that some C compilers will silently optimize index access into code that performs inc instead. But that relies on the compiuler recognizing special cases, whereas the safe way is to write code using inc directly.