I have to pass a lot of pointers in my code in the midst of a big loop, (so I have lots of expressions like foo(&x, &y, ...)
). I was wondering whether I should store the pointers as separate variables (i.e. cache) for performance (at the cost of introducing more variables and clutter in my code)?
(Doing lots of matrix mult. and the CUBLAS library insists on pointers...)
No -- the address-of operator is about as inexpensive/fast as anything you can hope for. It's possible to overload it, and such an overload could be slower, but overloading it at all is fairly unusual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With