Reed is right. For the change you are considering, the cost of calling a function is a small number of cycles, and you will need to do this 10 ^ 8 or so once per second before you notice.
However, I would caution that often people go to the other extreme, and then, as if calling functions was expensive. I saw this in redesigned systems where there were many levels of abstraction.
What happens is some kind of human psychology that says that if something is easy to name, then it is fast. This leads to writing more function calls than is strictly necessary, and when this occurs at several levels of abstraction, the loss can be exponential.
Following Reed’s driving example, calling a function can be a workaround, and if there are workarounds in the workaround, and if they also have workarounds, then a huge amount of time will be spent in the near future, for no obvious reason, because each calling a function looks innocent.
Mike dunlavey
source share