user1767754
user1767754

Reputation: 25094

Memory Consumption of Functions / Create More Functions in the name of Readability?

on modern computers, memory space is not a big question but with popular micro-computers, it is. So when i am coding, i try to split the code to functions in the sake of readability. Is there any evidence, that using more functions will decrease performance? How much?

void updateSignal(){
 checkData()
 processData()
 returnData()
}

void checkData(){
...
}


void processData(){
...
}


 void returnData(){
...
 }

Thank you very much

Upvotes: 1

Views: 46

Answers (1)

Mike Dinescu
Mike Dinescu

Reputation: 55720

This screams of micro optimization; even in the embedded world.

In many cases the complier will inline functions if they are small.

And from a performance standpoint, unless you are talking about really tight loops, a function call is not going to be very expensive (even in the case of virtual members which have more overhead)

I would argue that you should emphasive maintainability and readability and if you do see a performance problem you can then go in and optimize that area!

Upvotes: 4

Related Questions