optional argument versus subroutine overloading



Hello,
I've encountered some cases where a part of my program can be written
either as
1. optional argument(s), do one thing or another depending on the
presences of certain argument(s),
or ,
2. use subroutine overloading

In some cases (1) seem simple because I don't need to repeat a part of
code, while if doing (2) I need to repeat some part of codes that are
the same for several of the function/subroutine overloading (of course
I can always refactor, but in some cases I feel that too much re-
factoring actually is more confusing if it's beyond some sweet spot).

My concern though, is with performance. Which one perform better, if
this subroutine (either overloaded or using optional argument and do
presence test) is going to be called many times (tens of thousands)
inside a loop ? Is function/subroutine overloading actually resolved
during compilation, or during run time, as in the case of presence
test ?

Thanks for any insight.
RDB

.



Relevant Pages

  • Re: optional argument versus subroutine overloading
    ... || during compilation, or during run time, as in the case of presence ... ....and testing for presence of optional arguments, while not "free", ... no real performance concerns in any case. ...
    (comp.lang.fortran)
  • Re: optional argument versus subroutine overloading
    ... || during compilation, or during run time, as in the case of presence ... ...and testing for presence of optional arguments, while not "free", ... no real performance concerns in any case. ...
    (comp.lang.fortran)
  • Re: Whither repeats
    ... conclusive proof that these composers wanted the repeat ... observed - irrespective of the presence or absence of "extra bars". ...
    (rec.music.classical.recordings)
  • Re: Celtic Tiger - Warning for hmhawktoo
    ... >I'm agreeing there was no argument about the presence of tanks, ... >said that - how many times do I have to repeat it? ... Prev by Date: ...
    (soc.culture.irish)