Execution speed of overloaded functions

L

linvin333

Hi,
Does function overloading affect the speed of execution of the program
?
If so what is the reason ?
How does it compare with a speed of a program using non-overloded
functions ?


Linny
 
D

David White

Hi,
Does function overloading affect the speed of execution of the program
?

No. Why should it? Overloaded or not, the function will be translated to an
address, or inlined, or whatever. Any cost in resolving which function to
call is at compile time, not run-time.
If so what is the reason ?
N/A

How does it compare with a speed of a program using non-overloded
functions ?

The same.

DW
 
S

Stephen Howe

Does function overloading affect the speed of execution of the program ?

No. Execution speed is not affected at all.
What may be affected is the speed of compilation.

If you provided over 3 trillion different functions all called foobar(), the
compiler might takes some time working out which version is a best match for
arguments provided.

Stephen Howe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,664
Latest member
RoseannBow

Latest Threads

Top