4 ms·
Absolutely, but to learn more about the implementation you have to look at the function's code. Every line of that code poses the same problem, so it's recursiv
by fauigerzigerk 14y ago
Absolutely, but to learn more about the implementation you have to look at the function's code. Every line of that code poses the same problem, so it's recursive down to every last expression.
- nostrademons 14y ago...which may involve loops or conditionals that then involve tracing more function calls or performing other dynamic dispatch, and so on farther down the tree until you have to know the whole codebase. Eventually you run into the halting problem: you can never know whether a given line in an arbitrary program will be executed, because if you could, just replace that line with "HALT" and you've solved the halting problem. Can't we just agree that you can't predict the performance of an arbitrary program without measuring it? (You can predict the performance of some programs quite accurately, but that has nothing to do with language choice and everything to do with coding standards that bound execution time.)
- fauigerzigerk 14y agoIf you're saying that it doesn't matter if you know whether you're calling a virtual function or whether a parameter is passed by value or by reference then we cannot agree on that. If you have reason to use C++ at all, these are not things you can simply ignore because they can affect performance rather dramatically. What we can agree on is that knowing these things is just a small part of what affects performance and that performance can be rather unintuitive.