Apr-02-2022, 05:08 PM
I have come across statements saying that one should be careful about calling functions too frequently because of the performance overhead. Is this truly something that I need to be concerned about? I will assume for now that it is.
I have also come across statements warning about the use of "for" loops, also because of performance reasons, and that instead one ought to use the map feature.
However, almost all map examples call out to functions. While there are some examples with lambdas, this is probably not the best option when dealing larger and more complicated functions.
So, on the one hand, I can do a for loop and not repeatedly call function, therefore saving the function call overhead.
Or, I can use the allegedly more performant map feature in which I may have to do a function call and accept less than optimal performance.
What really are the things that I need to consider?
Thank you.
I have also come across statements warning about the use of "for" loops, also because of performance reasons, and that instead one ought to use the map feature.
However, almost all map examples call out to functions. While there are some examples with lambdas, this is probably not the best option when dealing larger and more complicated functions.
So, on the one hand, I can do a for loop and not repeatedly call function, therefore saving the function call overhead.
Or, I can use the allegedly more performant map feature in which I may have to do a function call and accept less than optimal performance.
What really are the things that I need to consider?
Thank you.